execute function after one completed

If you look at the source wp-includes/post.php, then you’ll see that wp_transition_post_status(), which contains transition_post_status, at both occurrences, in wp_insert_post() and wp_publish_post(), is called before the save_post hook. In short, the order is just different than you want it to be.

Main query not querying any posts in custom taxonomy template

I think the issue here is that when registering the post type, you’ve set exclude_from_search to true. See this note from the WordPress Coedex: Note: If you want to show the posts’s list that are associated to taxonomy’s terms, you must set exclude_from_search to false (ie : for call site_domaine/?taxonomy_slug=term_slug or site_domaine/taxonomy_slug/term_slug). If you set … Read more

Getting 400 Bad Request on AJAX Call

I believe the problem is here: // handle AJAX calls for both logged in and guest users add_action(‘wp_action_websites_cpt_create_post’, [$this, ‘create_post’]); add_action(‘wp_action_nopriv_websites_cpt_create_post’, [$this, ‘create_post’]); Because the format should be: add_action( ‘wp_ajax_{ACTION_NAME}’, [ $this, ‘create_post’ ] ); add_action( ‘wp_ajax_nopriv_{ACTION_NAME}’, [ $this, ‘create_post’ ] ); ..where {ACTION_NAME} is the “action” name, e.g. websites_cpt_create_post. See wp_ajax_{$_REQUEST[‘action’]} and wp_ajax_nopriv_{$_REQUEST[‘action’]}.

how to set a WP Plugin’s url

This is a perfect use case for WordPress’ REST API. It probably makes sense, to create a custom endpoint, where you can in detail define what results you need. Something along the lines of <?php add_action( ‘rest_api_init’, function () { register_rest_route( ‘kostas_calendar/v1’, ‘/feed/’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘kostas_calendar_endpoint_feed’, ) ); } ); function … Read more

Warning: call_user_func_array() expects parameter 1 to be a valid callback

The warning is clear: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘cookie_GA’ not found or invalid function name in C:\wamp64\www\wordpress\wp-includes\class-wp-hook.php on line 286 So cookie_GA() is not found. When can this be the case? Well, of course when is_allowed_cookie(‘_ga’) is false. So either wrap the add_action() call inside that if as … Read more