Hot answers tagged

3

First, you should always use the WordPress AJAX methods, not a custom function for that. See AJAX in Plugins in the Codex. With that practice in mind, you can set up your request like this. Change the AJAX URL to <?php echo admin_url('admin-ajax.php'); ?> and add the actionyou want WordPress to execute in the next step to your data . ...


1

Note that if you have the post slug, you don't need the additional taxonomy query to find that post, so it makes sense to drop the expensive taxonomy query in core in that case. Otherwise you could try instead the post_name__in parameter: [ 'post_name__in' => [ '<postslug>' ], 'tax_query' => [ [ 'taxonomy' ...


1

You'll need to run two queries here First query we will be returning all top level pages (I assume Asia, Africa and America is top level pages) Second query we will get all direct children of the top level pages returned You can try something like the following: $parent_id_args = [ 'post_parent' => 0, // Get all top level pages 'post_type' ...



Only top voted, non community-wiki answers of a minimum length are eligible