Randomizing your tags doesn’t matter much to WP_Query. If you want random results, try adding 'orderby' => 'rand'
to your $args. This should randomize the stories returned. If not, try applying shuffle()
to $my_query
before iterating through them. Some web hosts have reportedly disabled the 'orderby'=>'rand'
method of querying posts. For these hosts shuffle()
seems to still get the desired results.
NOTE: If you go with the shuffle()
method, you probably want to replace the posts_per_page value with ‘-1’ and add a loop counter to your output loop. Otherwise, you will always be shuffling the first four stories.
Related Posts:
- Remove Categories / Tags From Admin Menu
- Setting Custom Sort Order of Posts within a Category
- Custom permalink structure only for default posts
- Exclude drafts in all() view of edit.php
- Is this the best (and only) option to style CSS for a given post type?
- Sort post by attributes ‘order’
- How to change the layout and styling of posts according to their category in WordPress?
- adding a custom css class to post
- Prevent duplicate posts in wp_insert_post using custom fields
- Add default content to post (for specific category)
- Pagination not working on Custom Page Template
- Display custom post types by date field
- How to hook a function only when I need to delete permanently a post?
- display order of connections
- same template for multiple custom post type single
- How to place HTML below the title of the (custom) post overview
- How to get a nofication when post submitted
- Is there any WordPress alternative to Book module of Drupal?
- .current-menu-item class on custom post type children pages – again?
- Display page content AFTER a loop of posts
- Run a function when post is deleted?
- How to start with post number x?
- How can I create custom button in post.php
- how to replace embedded “full” sized images within a post with the “large” ones
- Downgrade user from role that allows post creation
- Best way of deletion of old posts [closed]
- Animated gif for a thumbs
- Sidebar links for different pages
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- I am unable to publish/update post
- Delete post by giving its link
- Get posts of ONE taxonomy term of custom post type
- WordPress Custom Fields (Checkboxes with multiple values)
- How to make classes for posts?
- Custom Post Archive Page not working
- Adding buttons to Add New Post and Add New Page
- Getting Custom Post Loop to display in Bootstrap 3 column grid
- WordPress custom Query for Posts in Category display posts multiple times
- ERROR: Your feed is invalid (after update WP4.7) in custom types
- Editing the default page to show all posts, rather than most recent ones
- Automatically add date to the auto generation of post slug
- How could I change my Permalink from blog to custom structure? [closed]
- WP Admin register taxonomy and post type performance
- Add a custom meta box in the post options that loads some html code in the header
- Static posts page with home.php
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Custom post types related to same custom post type?
- Format latest/newest post differently
- relating business and products with custom taxonomy?
- Using setup_postdata() with multi-dimensional array
- Check if a custom post type has already been created
- WordPress Query Posts From Category Post on Static Page
- Edit multiple custom post types while saving a new or edited post
- How to allow multiple thumbnail upload for Posts?
- add external project to web site wordpress on production
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- register_post_type permalink
- Custom Post Limit for homepage only without plugin?
- Static pages not working
- Change default post style to columns
- Post titles and thumbnails as links to custom post types?
- Custom Post Type, post-formats associated to custom post type > 404 archives
- Adding a custom post type meta field to rss
- Help with listing current users submitted custom post type in template file
- Delete post from admin but not from database
- Custom Select Query – Selecting the Year?
- Deleting old posts
- How To Use Custom Tax of a Post Type
- What would causes search to return incorrect results?
- get posts, run a custom query, and join the results
- search form for custom fields
- Some custom post types did not return an object
- Display Post from Custom Post Type with Shortcode
- Tag for custom post type
- Modified core/image rendering not showing in posts – only on pages
- Not display an image of category of custom post
- Show post count in custom taxonomy page
- Post relationships/nesting
- Manual Scheduler For Custom Post Type
- Dev and prod on the same database- dev version active for IOS
- How to delete/customize imported demo content from a theme or add my own?
- Displaying dynamic content (blog posts/portfolio) on a static homepage and keep the blog post styles
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- Multiple Custom Post Type loop logic
- WordPress search for specific Post Type
- How can you control what a user is allowed to post in the backend?
- How to show content of specific item on the same page?
- How to list all names and descriptions of a custom taxonomy
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Show a Category Specific Info Box
- Make a custom URL and link to custom Template
- Special Query: Title, Terms, Content – %LIKE%
- First Custom Post Custom Fields Empty After New Custom Post
- WordPress 3.2 – Problem with WYSIWYG editors in a custom post type?
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- How to have more post in a page than in your home page
- Only show posts belonging to multiple cateogries at same time
- Dynamic Menu Item
- Changes done in admin panel are taking time to reflect in the REST api responses
- I have a website issue I am trying to resolve