Your query parameters don’t contain any category arguments. You need to pass and set cat
or category_name
along with the post type, offset, and posts per page. You can get the current category’s ID via get_queried_object()
:
$queried_object = get_queried_object();
$cat_id = $queried_object->term_id;
Output and retrieve the value somewhere in your category template, or better, when you enqueue your ajax javascript, check if is_category
and use wp_localize_script()
to pass that data to your script.
Related Posts:
- POST from jQuery to PHP
- Call current post URL in ajax
- Ajax post doesnt call succes after got the response
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- Ajax success function
- Confirmation box when submitting post for review
- WordPress Ajax always returns a 404 error
- Dynamically update post title in admin page
- Getting an alphabetic post list with two letters onclick on letter
- How to load post content on index page using ajax when post title in sidebar is clicked
- Handling an Ajax form submit
- “Uncaught SyntaxError: Unexpected token
- Add confirmation popup on “Move to Trash”
- Click loads template via ajax
- The correct way to call posts with ajax
- How do I use Ajax to show the new posts realtime, on the frontpage
- 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]
- How to speed up admin-ajax.php in wordpress
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- How to create a load more post entries like Twitter?
- Sending jsPDF documents to the server
- Ajax return code 400
- how to set beforsend option in wordpress ajax methods
- How to test nonce with AJAX – Plugin development
- class click counter save number
- AJAX request status 200 but no actual “response”
- Ajax load more button in Recent posts widget
- Ajax Dynamic Archives not showing correct results
- WP_Query with ajax handler returns the same posts
- Ajax post filters not working
- Save Search System
- dynamic dependent select dropdown
- Ajaxify This Code
- How to add a do_action on refreshing of WP customizer?
- Setting value of session with Ajax not working
- Genesis + Ajax + Jquery | Failling to call action
- AJAX not Working with php as supposed
- 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
- wordpress add_action() issue in ajax call
- Load Posts on Click via Ajax into a DIV
- Why i can’t get custom fields value or post ID via Ajax?
- Incrementing PHP variable onclick to display posts by month
- Accessing an API with jQuery and AJAX
- displaying the categories post
- Using the loop to set locations for all posts on a single google map
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- duplicate posts with ajax load more wordpress
- Post form – AJAX won’t upload featured image – Plugin development
- Admin-ajax.php 404 error
- How to pass values from one function to the other using an array variable
- How to use wp_ajax_set_post_thumbnail?
- Update $wpdb query with AJAX
- AJAX to add to cart multiple products woocommerce
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- Many buttons not functioning in WordPress dashboard (as admin)
- 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?
- number of posts with “Load More”
- Find the method which AJAX GET calls
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- 500 (Internal Server Error) of external php file
- WP Load post with ajax and apply isotope
- Dynamic Gallery
- Get post id on click of thumbnail
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- notify users when changed database
- AJAX response error: net::ERR_EMPTY_RESPONSE
- JqueryUi Dialog giving Uncaught TypeError: this._addClass is not a function error
- which action to hook to in order to perform post-publish action
- Update WordPress Custom Field with AJAX on cached page
- Strange switch_to_blog() issue
- How to Use JSON With AJAX?
- $post object is null
- Returning a value from a PHP page
- Send post id through ajax and get the post content back
- Can’t get full post title if there a spaces in title
- Get related product based on subcategory selected from category id with ID 142
- How To Use Custom Fields With .mp3 Links
- How to display contact form 7 form in vanilla js without jquery in frontend
- Ajax call not working in wordpress through a plugin
- How to call my PHP function with AJAX ? wp_query
- Ajax sometimes work and sometimes just don’t work
- WordPress ajax filter returning all posts when it should be filtering by category
- Javascript output now showing in custom widget
- Show a Category Specific Info Box
- How to get all the terms of a post
- Load php function with AJAX on modal window
- Ajax calls in wordpress
- Adding a content rating system
- JSON Object Value Show Undefine