Filter Hook callback error, is it due to using $this inside a filter or something else?

Problem The issue is that WordPress uses call_user_func() or call_user_func_array() to allow plugin/theme developers to add callables to hooks. Callables, or callback functions, can be simple functions, object methods, or static class methods. We need to format the callable as either a string or array depending on the type of callback we want. Simple Functions … Read more

“Cannot modify header information” means I can’t use wp_redirect

As Milo stated, you can’t send header information after PHP has begun sending request response body. Redirects belong in a function hooked into wp_loaded to ensure they run before the request body is generated. You need something like the following in your functions.php file: function hook_wp_loaded_require_login() { $uri = ( isset( $_SERVER[‘REQUEST_URI’] ) ) ? … Read more

class-wp-hook.php on line 288

Reinstalling core should fix this issue. This is more than likely related to a botched update from 5.3 to 5.3.1. Edit: To clarify, 5.3.1 included some hardening with relation to kses (specifically wp_kses_bad_protocol()) as noted in the release post. In the error output above, a core file was referencing a core function that didn’t exist, … Read more

Which is the correct way to conditionally enqueue a CSS file?

I agreed with @PatJ — you should check if get_queried_object() returns an object or not. But you could simplify your code by simply using is_category() and in_category() which are conditional tags in WordPress: if ( is_category( 3 ) || in_category( ‘arta’ ) ) { wp_enqueue_style( ‘twentytwenty-style-2’, get_stylesheet_directory_uri() . ‘/style-arta.css’, array(), $theme_version ); }

Updating posts exceeds maximum execution time

You do have a large amount of posts which will crash your server (due to maximum execution time being exceeded) with such an expensive operation. We will need to run this in a much more cleverer way. First of all, we would want to get all posts, except revision and nav_menu_item. Revision post_names are build … Read more

Suddenly forbidden 403 error on some pages

Please check the permissions of files and folders. All folders should have permission set to 755 and files should have 644 . If permissions are different than specified, please try changing the permissions. You can easily check and change permissions using filezilla. Let me know if it helps.

WordPress: Notice:Object of class WP_Query could not be converted to int in on line

Your problem is here: $featuredPosts = new WP_Query(); $featuredPosts->query(‘showposts=”.get_option(“mp_slides_no’).’&category_name=”.get_option(“mp_featured_cat’).”); for($i=1; $i<=$featuredPosts; $i++) { You’re creating a new instance of WP_Query to run a custom query and storing it in the $featuredPosts variable. But then you’re trying to use $featuredPosts as the upper limit of a for loop. This is what PHP is complaining about. Your … Read more