imath / entrepot

A list of free GitHub.com hosted WordPress plugins, themes & blocks
https://imathi.eu/entrepot/
GNU General Public License v2.0
31 stars 6 forks source link

Blocks are not found into the WordPress Blocks Repository #39

Closed imath closed 3 years ago

imath commented 3 years ago

As querying for blocks of the WordPress Blocks Repository is happening using a REST request, the context is not set to admin. The problem is the Entrepôt inc/admin.php file is not loaded but the inc/hooks.php is. As a result the plugins_api filter is fired but the callback is not reachable it's causing the search to fail as The Plugins API returns Null although the filter is expending false to query WordPress.org. Checking for is_admin() is fixing the issue.

More globally Admin hooks should be in a different file and this file should only be loaded if the admin context is on.