Genesis Blocks: Call to undefined function add_action()
-
I had Genesis Blocks Version 1.3.0 installed
probably because of it there was a 500 script errorjust appeared on the site in both browsers
the site takes an INCREDIBLY long time to load and then this:504 Gateway Timeout
nginx/1.20.2just worked.
AND ADMIN IS LOADING NORMit means the site script has gone into a loop
I created GUTHENBERG blocks in the admin panel TODAY ALL DAY
well the DB became a little more. but it’s not DB.Viewing the Query Log on hosting
[Wed Apr 27 21:42:26.726309 2022] [cgi:error] [pid 4912] [client 192.168.1.1:55110] AH01215: PHP Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /var/www/u7439/data/www/themes-wp.ru/wp-content/plugins/genesis-blocks/genesis-blocks.php on line 23: /var/www/php-bin-isp-php56/u7439/php
and many such similar errors
23 – first line in code:
function genesis_blocks_load(): void { $context = [ 'url' => plugin_dir_url( __FILE__ ), 'path' => plugin_dir_path( __FILE__ ), 'version' => get_file_data( __FILE__, [ 'Version' ] )[0], 'theme' => sanitize_title( get_stylesheet() ), ]; ( new Genesis\Blocks\PluginLoader( $context ) )->init(); } add_action( 'plugins_loaded', 'genesis_blocks_load' );
it could be a php version error
i updated the plugin
Genesis Blocks Version 1.4.0
and the error has changed
[Wed Apr 27 21:45:36.202906 2022] [cgi:error] [pid 6097] [client 195.211.23.207:56242] AH01215: PHP Fatal error: Uncaught Error: Call to undefined function add_action() in /var/www/u7439/data/www/themes-wp.ru/wp-content/plugins/genesis-blocks/genesis-blocks.php:33: /var/www/php-bin-isp-php74/u7439/php
33 – last line in code:
function genesis_blocks_load(): void { $context = [ 'url' => plugin_dir_url( __FILE__ ), 'path' => plugin_dir_path( __FILE__ ), 'version' => get_file_data( __FILE__, [ 'Version' ] )[0], 'theme' => sanitize_title( get_stylesheet() ), ]; ( new Genesis\Blocks\PluginLoader( $context ) )->init(); } add_action( 'plugins_loaded', 'genesis_blocks_load' );
add_action() is a basic WP function
I don’t know how it can be that the php file with the necessary include is missing.
can we assume that the /wp-content/plugins/genesis-blocks/genesis-blocks.php file is included before the WP core?of course you can write
if (function_exists("add_action")) add_action( 'plugins_loaded', 'genesis_blocks_load' );
but that’s probably wrong?PHP Version normal
https://www.ads-software.com/plugins/genesis-blocks/Genesis Blocks 1.4.0
PHP Version: 7.1 or higherused for site – CGI 7.4.28 (alt) and WordPress 5.6.5
- The topic ‘Genesis Blocks: Call to undefined function add_action()’ is closed to new replies.