Nested Actions and Filters
Nested Actions and Filters
Nested Actions and Filters
WPML – Hook when language is switched (change user language)
I finally, finally figured it out! I was not able to get the category id in the first place. Strangely, get_query_var(‘cat’) is not working. Here is the way that worked for me, in case someone else also struggles with this: function my_new_category_order( $query ) { $category = get_queried_object(); $cat_id = $category->term_id; $post_order = get_term_meta($cat_id, ‘post-order’, … Read more
do_action doesn’t trigger if it’s in a template that gets loaded via REST endpoint
Post is uncatagorized in publish_post action
The get_query_var() function and/or method only works with registered WordPress query_vars. You can actually view the method via get_query_var(). The normal URL parameters you can access with the normal PHP super global $_GET.
Add custom action to the page listing screen
You unhook things the way you added them. In this case, you need to pass a callable that matches what was added. Normally this is the function name e.g. ‘my_function’, but for an non-static method in an object, it has to be [ $object, ‘method_name’ ] where $object is a reference to the object. How … Read more
You can’t hook an AJAX action from within a shortcode, and the constructor for Wp_Lbs_Calendar is only running inside your shortcode. This means that the actions are only hooked to wp_ajax_ when your shortcode is used on the page. But the AJAX request is a separate request to admin-ajax.php, and your shortcode is not running … Read more
Overriding Plugin function in your child theme