I have just made this on a rush but would you please try this :
<?php
if( is_tag() ){
$tag = single_tag_title('', false);
}else{
$tag='';
}
if( is_category() ){
$cat = single_cat_title('', false);
}else{
$cat="";
}
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'tag' => $tag,
'posts_per_page' => $ppp,
'category_name' => $cat,
'offset' => $offset,
);
?>
Related Posts:
- Display posts from only one post form in custom query and exclude in main query
- Creating attachments archive in tags and categories
- Posts with at least 3 tags of a list of tags
- wp_query->max_num_pages always returns 0 on custom post type
- Better way to get tag stats?
- $wp_query initiation?
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- ajax category filter
- next_posts_link not working for loop called with ajax
- How to order posts tag by tag?
- post_type is ignored by WP_Query when ‘tag’ argument is included
- WP Rest API v2 return posts with specific tag
- Ajax and WP_Query/tax_query parameter
- Loop through all tags & output posts in alphabetical list
- Load more AJAX on WP Query
- get data from wp-query, outside the loop & without url change
- Order posts by tags count?
- Custom archive page based on array of categories and tags
- How to pass custom parameter to WP_Query for filtering in pre_get_posts
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- ‘posts_where’ filter not applying ‘WP_Query’ in `wp_ajax`
- Ajax Infinite Scroll In Custom WP_Query Loop Not Working
- How to get any tag ID
- Using AJAX to return search form results
- WP_Query class not found
- Get all posts without tags
- Search – Ajax – Alter Query Parameters with Pagination
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- How to wp_query posts with ajax
- WP_Query orderby breaks when using AJAX?
- How to get user_id from wordpress database inside ajax function?
- How to exclude products by tag from woocommerce shop page?
- Pagination problem after WP_Query with tag filtering
- Update Loop with Form
- WP_Query & AJAX
- Sticky Post default functionality with WP_Query is ignored when using AJAX
- Refine/Filter WP_Query Posts with jQuery or Ajax
- Show selected images on top in Media Manager
- Tell wordpress to show a single page instead of an archive
- Create unique page without header.php for json feed
- WP_Query ajax loader detect end of posts
- wp_query not searching with apostrophe
- Query post from all category with same tag on 1 pages
- reducing the amount of wp_query calls
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- WordPress Related Post by tags in Single.php
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- List of the years with posts presented
- Include custom field in Ajax search WordPress
- Ajax Pagination on Ajax filter
- Wp_query returning only one post while query through ajax
- How to build a WP_Query using mulitple tags and using AND or OR operator between them
- Include tags in WP_Query
- Search for multiple tags?
- From where is archive.php getting its posts?
- Ajax load more posts – WP_Query parameters not working
- Remove category from query (show all posts in archive.php) pre_get_posts()
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Load More Posts Button – AJAX
- how to handle multiple ajax wordpress queries?
- Display tags with random thumbnail from selection of posts with that tag
- Ajax WP_Query reutrns no results on author.php
- Query posts intersecting tags and categories
- Two loops on archive page
- How to order posts by title after they have already been sorted by category
- Combining categories (Query posts with multiple taxonomy terms)
- Filtering out child category posts from parent category archive not working
- Current post in AJAX call is always zero
- Filter wordpress post categories with jquery/ajax and pagination?
- Order by most used tag
- WP Query with multiple tags by get the tags
- Ajax future single post query doesn’t work when NOT logged in
- How to not display tags with less than X posts
- how update data through ajax and jquery
- Error with function in functions.php?
- Query Posts by Tag and exclude
- Use Ajax To filter posts?
- Display if author page is author page of current user
- Get posts that do not have the same tags as current
- exclude product with available tag
- Change AJAX filter from POST to GET for URL Parameters
- Filtering posts by archive showing all years
- Loading two different AJAX requests on two different pages
- AJAX Breaking Offset Argument In WP Query
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- Apply filters to main query instead of creating new one?
- WP_Query offset is returning post from prevois loop
- How to use a dropdown to filter posts by custom field
- WP_Query by keyword OR post tag
- Does WP_Query ‘responds’ badly to empty arguments?
- Retrieve data from wordpress db via input and put those result in dropdown
- Display posts by tag
- WP_query is not returning the expected result
- WordPress dynamic AJAX query
- Get posts with no tags?
- ajax wp_query conditional tags not working
- Post archive for certain post format