Change it from:
'category_name' => celebrity,
'orderby' => 1,
into
'category_name' => 'celebrity',
'orderby' => 'date', // or something else
Otherwise celebrity
will be treated as a constant name, not a string. Also, you can’t order by 1
, you have to use one of the ordering parameters.
Related Posts:
- Can I force WP_Query to return no results?
- Multiple WP_Query loops with Pagination
- WP_Query vs get_posts
- WP_Query and next_posts_link
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- Get array of posts from the current archive page loop
- How can I save an array from a random post sequence for later use?
- How to place a loop within another loop?
- In loop: posts have thumbnail AND other variables
- How to order category.php loop by ‘meta_value’?
- Pagination/infinite scroll with WP_Query and multiple loops
- Add inline HTML to posts published within last 24hrs
- Move posts to top of WP_Query if in certain Taxonomy?
- Ajax Infinite Scroll In Custom WP_Query Loop Not Working
- Display different number of posts from one category on the different pages
- Pagination not working Search posts
- How to change a custom query into a standard loop?
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- wordpress query in header won’t reset and corrupts other loops
- Implementing an OR statement to wordpress wp_query
- Get List of all the Authors
- 2 loops on page – one with orderby rand second orderby date
- Undefined WP_Query::has_posts()?
- WP_Query loop within WP_Query loop
- Refine search results using WP_Query
- How to pass many ids in post__in?
- How to use WP_Query to display many posts?
- How to show subcategories using loop?
- Sub-loop / nested loops Best Practices
- Five posts from a category in footer
- Show Sticky Post at the top but do not show again in the loop?
- Any number in meta key (wp query)
- How to get all unique categories for posts in loop?
- How do I run through a WordPress loop called from a filter function?
- How do I get the title of a category in a custom loop?
- Order by empty custom field
- Out Of memory issue on post per page parameter
- Check if loop has any categories?
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- New WP_Query loop in admin causes problems
- Need to convert string of term ids into comma separated integers for use in an arguments array
- Change query from cat id to slug or name?
- How do I get my custom query to work with search results after the first page?
- Using Wp_Query without the loop?
- Custom WP_Query id
- Assign custom parameter to each post in query
- How to use WP_Query() on single.php?
- difference between querying database and using the loop
- Loop increase in while loop not working
- posts archive page – closing WP_Query loop correctly [closed]
- AJAX Breaking Offset Argument In WP Query
- How does WP generate the default $query in WP_Query based on the URL?
- Continue or break the while loop
- how to get category`s slug in WP_Query loop?
- How to remove only the latest sticky post from the loop
- How I can repeat 2 HTML templates in a WordPress Query?
- Function using get_posts() with tax_query not working when called from functions.php
- Offset WP_Query by negative 1
- WP_Query orderby random do not repeat infinite scroll – one loop
- Advise on Templates for Custom Queries
- Query WP Page for Buddypress Group Home [closed]
- $post in wp_query?
- How to pass the current content of $wp_query to a new page?
- How to make the ‘request’ filter work?
- How to separate two columns from one content on a page template?
- Can I alter the main loop to ‘orderby’ a custom callback?
- How do I stop the same post showing multiple times in a archive?
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Avoid removing duplicate posts
- how to get custom attachment url?
- WP_Query & Duplicate entries
- Regarding a custom loop and output HTML tags
- Repeat array inside array through while loop
- What’s causing an infinite loop?
- pages shortcode filtering by category
- Second WP_Query loop shows data from main query
- Meta Query if Values Don’t Exist
- Get post Number with local loop and template
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- Calling a function with WP_Query only ever brings the first result
- display post multiple times based on array of dates
- Problems with WP_Query, Loop, a condition and Posts per Page
- WP_Query secondary query failing
- Create multiple sections for all categories and then queries all the posts for each of those categories
- Custom search (wp query by custom fields)
- Sorting is not working in WordPress WP_Query
- Add custom WP_Query after the first 3 posts
- Limit the number of posts from a specific category on index.php
- Next / previous posts link doesn’t show up with Posts 2 Posts
- WordPress Post Looping? [duplicate]
- Carousel Loop only duplicating
- Remove 5 latest posts from the loop
- Exclude post formats in custom loop
- How to show featured post first, then separate loop for other posts
- Show linked products using wp query and woocommerce
- Standard Loop – wp_query
- Custom Wp_query loop takes very long
- Custom query for certain post type OR another post type with a certain category
- Pagination only showed when no category is set in wp_query