Firstly your cat
parameter expects an array and you’re passing a json string to it… You need to json_decode back your array of posts to run through the query.
Secondly, you are using query_posts()
which if you look at the codex page reads:
Note: This function will completely override the main query and isn’t intended for use by plugins or themes. Its overly-simplistic approach to modifying the main query can be problematic and should be avoided wherever possible. In most cases, there are better, more performant options for modifying the main query such as via the ‘pre_get_posts’ action within WP_Query.
This must not be used within the WordPress Loop.
So, fix the cat issues and use get_posts()
or WP_Query
here and I’d be very surprised if you still have issues.
Related Posts:
- Handling an Ajax form submit
- Load Posts on Click via Ajax into a DIV
- Incrementing PHP variable onclick to display posts by month
- Post form – AJAX won’t upload featured image – Plugin development
- Ajax Load More Posts in Category Page
- WordPress Ajax always returns a 404 error
- Ajax template: how to handle head section
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Data fetch and delete by ajax request
- Using a javascript file to access a get posts array
- Custom WordPress+PHP+MYSQL+AJAX form, submit event not captured by Javascript, but does POST data to the DB
- Click loads template via ajax
- Display notification only once
- Access/update database with jQuery
- How to display something in a div when the user clicks on a text in another div – no page refresh [closed]
- admin-ajax.php responding with 0
- How to speed up admin-ajax.php in wordpress
- Page Reloads Before AJAX Request Finishes
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- How to make custom total price reactive in navigation
- Sending jsPDF documents to the server
- How to prevent those PHP variables from being cached on WordPress?
- Ajax return code 400
- Trying to implement Ajax comments in WordPress, getting WP error
- How to test nonce with AJAX – Plugin development
- class click counter save number
- AJAX request status 200 but no actual “response”
- Ajax not working es expected (Returns 0)
- Creating a Multi-Level Associative Object Using AJAX
- Ajax – Call to undefined function get_option()
- Status 400 for AJAX POST Request with admin-ajax.php
- Ajax random number always the same
- Image upload via FormData API and AJAX is not working ($_FILES always empty)
- Save Search System
- dynamic dependent select dropdown
- How to send Ajax request from my plugin in admin dashboard?
- Open post-content in archive page in a Modal box with bootstrap
- How to add a do_action on refreshing of WP customizer?
- How to pass Select value from Javascript to PHP to generate select option on change
- Setting value of session with Ajax not working
- AJAX success response is not working but it’s saving my changes
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Post repeating with infinite scroll
- Fancybox type popup window that’s not an iframe
- How do I Import / Upload Files with jQuery AJAX?
- WordPress Ajax Call inserting data but success response false
- admin-ajax Firing Error 400 When Logged In
- Making an AJAX call to refresh a table
- HTML escaping data with ajax requests
- load ajax using admin-ajax.php
- set post limit at load more ajax wordpress
- AJAX wp_insert_user WORKS but responds with “The site is not enabled”
- Get related product based on subcategory selected from category id with ID 142
- Why i can’t get custom fields value or post ID via Ajax?
- Cannot access $wpdb, comes back NULL
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Loading Posts & Category with Ajax
- Accessing an API with jQuery and AJAX
- Ajaxurl suddenly not defined
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- How to use wp_send_json() and output the value with ajax?
- Update $wpdb query with AJAX
- $.ajax results in 403 forbidden
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- AJAX to add to cart multiple products woocommerce
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- wordpress dependent dropdownlist using post type is not working
- How to echo a PHP code into WooCommerce variation product?
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- How to call a function from functions.php with ajax?
- ajax polling with admin-ajax.php
- Custom Post type Ajax search results
- number of posts with “Load More”
- Ajax wordpress function showing source code in alert and not value of input field?
- How to send Ajax Call from frontend without using wp_localize_script in Theme
- How to load WP_Editor JS files manually (with AJAX)?
- Find the method which AJAX GET calls
- A javascript function that simply runs a php function on the plugin
- Retrieve $_POST data to send to javascript without using localize script
- Apply filters when loading post via ajax
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- 500 (Internal Server Error) of external php file
- Problems with plugin that fetches data from database with ajax
- Dynamic Gallery
- Execute PHP code in Javascript onclick
- Load php function with AJAX on modal window
- link to page_for_posts
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- notify users when changed database
- Remove Woocommerce product from cart with ajax/fetch
- WooCommerce Modal Fly cart on add to cart – With AJAX
- How can I use AJAX in child theme template?
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- Start a long running PHP process via JS/Ajax and monitor progress on admin page
- Display posts based on the selected category when no subcategory is chosen
- How to make this shortcode not refresh the whole page when i use it on frontend
- GET admin-ajax.php returning 400 bad request error
- Issue with Ajax filter categories and Javascript
- How do I ensure that the URL parameters are updated correctly when multiple filters are applied