Yep, I’ve just spent the last two hours trying to figure out what was wrong with the site. For shop managers, or editors, its failing, on multiple sites.
In the end I put a backtrace on the wp_die with this code:
// Remove this code after debugging
function log_wp_die_backtrace($message, $title = '', $args = array()) {
error_log('wp_die called: ' . print_r($message, true));
error_log('Backtrace: ' . print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true));
_default_wp_die_handler($message, $title, $args);
}
add_filter('wp_die_handler', function() {
return 'log_wp_die_backtrace';
});
And this debug setting in wp-config.php:
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);
And that output the culprit:
[13-May-2024 21:52:39 UTC] wp_die called: You do not have permission to access this page!
[13-May-2024 21:52:39 UTC] Backtrace: Array
(
[0] => Array
(
[file] => /home/sitename/public_html/wp-includes/functions.php
[line] => 3785
[function] => log_wp_die_backtrace
)
[1] => Array
(
[file] => /home/sitename/public_html/wp-content/plugins/popup-builder/com/classes/Updates.php
[line] => 110
[function] => wp_die
)
[2] => Array
(
[file] => /home/sitename/public_html/wp-includes/class-wp-hook.php
[line] => 324
[function] => sgpbActivateLicense
[class] => sgpb\Updates
[type] => ->
)
[3] => Array
(
[file] => /home/sitename/public_html/wp-includes/class-wp-hook.php
[line] => 348
[function] => apply_filters
[class] => WP_Hook
[type] => ->
)
[4] => Array
(
[file] => /home/sitename/public_html/wp-includes/plugin.php
[line] => 517
[function] => do_action
[class] => WP_Hook
[type] => ->
)
[5] => Array
(
[file] => /home/sitename/public_html/wp-admin/admin.php
[line] => 175
[function] => do_action
)
[6] => Array
(
[file] => /home/sitename/public_html/wp-admin/index.php
[line] => 10
[args] => Array
(
[0] => /home/sitename/public_html/wp-admin/admin.php
)
[function] => require_once
)
)
I’ve commented out the hook which is calling the rogue line in the bold reference above, which has fixed my site:
// add_action('admin_init', array($this, 'sgpbActivateLicense'));
I think thats a good enough fix for tonight as I expect you will be releasing a hotfix for this as soon as you see this thread…