Function Hooked on Init Running Multiple Times
Function Hooked on Init Running Multiple Times
Function Hooked on Init Running Multiple Times
How to resolve 500 error in post listing page?
As deduced from the comments, and the source code, the ID for new posts is only generated after the hook wp_insert_post_data, the wordpress codex is misleading in this regard.
You need to limit yourself to the main loop and this can be done by checking if is_main_query returns true. This might not be enough as that hook/filter was probably designed with the intention of augmenting the summery and therefor might be called more then once even during execution of the main loop itself. You … Read more
Apparently “the_author” is an appropriate filter. Also, $author is apparently a universal variable, so this code worked out fine: add_filter(“the_author”, “change_author”); function change_author($author) { $author = “NEW AUTHOR!”; return $author; }
You probably don’t have enough visitors on your site. Although it looks otherwise WordPress doesn’t actually schedule the events. It writes the time when it should happen to the database, and only when somebody visits the site WP gets fired up, checks the database and fires the event. So, if nobody is around at the … Read more
These are WooCommerce end-points. I don’t see any filters for the yoast sitemap except for stuff like taxonomies. I think you could submit it as a feature requests trough their github page. https://github.com/Yoast/wordpress-seo/issues
When $post is null for get_post it looks to $GLOBALS[‘post’]. There are several other checks in the source so perhaps you should find out the value of the global variable when you’re calling it or give it something besides and empty value. What does get_the_id() return vs. get_post(get_queried_object_id())? Or var_dump(get_queried_object())? get_post() – Retrieves post data … Read more
You have all explained in this function for instance File: wp-includes/plugin.php 402: /** 403: * Execute functions hooked on a specific action hook. 404: * 405: * This function invokes all functions attached to action hook `$tag`. It is 406: * possible to create new action hooks by simply calling this function, 407: * specifying … Read more
Note that: add_action( ‘password_reset’, ‘remote_password_update’ ); is like calling: add_action( ‘password_reset’, ‘remote_password_update’, 10, 1 ); where 10 is the default priority and 1 is the number of arguments. You need: add_action( ‘password_reset’, ‘remote_password_update’, 10, 2 ); with 2 as the number of arguments. Now you should be able to access the $new_pass input variable.