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
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- Implement AJAX ‘load more’ with offset posts
- How do I ensure that the URL parameters are updated correctly when multiple filters are applied
- Only show a Post once in 10 visits
- How to return multiple arguments from AJAX callback function
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Ajax contact form return 0
- Dynamically switch template on click
- AJAX – Returning Two JSON Objects with One PHP Function
- Pull GetOption() variable into jQuery dynamically created html
- Security to delete post by Admin
- url – ajax loaded but no JS
- Page template is accessing the incorrect posts?
- admin-ajax Firing Error 400 When Logged In
- Error – ‘create_function is deprecated’ [closed]
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Unset session variable on page reload / setup but exclude AJAX
- Add Ajax Hooks and Call from Custom Template PHP
- Making an AJAX call to refresh a table
- HTML escaping data with ajax requests
- WordPress Ajax Always returning 0
- Is it save to use eval for a jQuery callback method coming from the database?
- Jquery window.send_to_editor function
- load ajax using admin-ajax.php