A standard WordPress install doesn’t keep track of visits to pages/posts. So without a plugin there’s no way to know which posts/pages are visited most often. As to finding random posts that’s as simple as:
$args = array(
'post_type' => array( 'post', 'page', 'my-custom-post-type' )
'orderby' => 'rand',
);
$query = new WP_Query ($args);
Related Posts:
- How do I reorder (pop and push) items from WP_Query?
- Reverse chronology of post listing
- Ajax load more button in Recent posts widget
- WP_Query orderby not working with meta_value_num and menu_order
- How can I sort posts by the date and a custom meta field?
- How to order posts by meta_value and title
- how to get post order by post id wp_query?
- Display current post position in Elementor Posts widget
- How to show multiple posts thumbnail, title and date in widget
- query posts with selected post ids first
- WP_Query sort by meta_value_num or date
- Random order of the 5 most popular posts
- My custom query is displaying random posts in random order
- Get query result according to merged array
- Order by ‘s’ using WP_Query()
- Image inside the content is replaced with featured image from my older post
- Order by Post Title in WP Query not working
- Any way for get_next_post() to use the actual post order instead of publish order?
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- Exclude the first ‘n’ number of posts of a tag from home page?
- Query posts and return XML
- how to change the number of posts returned in a specific loop without making it global?
- Query Posts With Over 1000 Views
- remove post and categories/tags count from right now dashboard widget
- Custom order for Mysql array
- posts_per_page option limits the number of Gallery items
- List authors with the last post title and order by last post date
- wp_query random post
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Adding a blog archive with pagination using WP_Query
- How to get Tags with specific post id
- Order posts alphabetically: how to set order=asc in mysql query?
- how can i change WP main archives loop to sort by name or title
- Using wp_list_pages() after calling query_posts()
- Possible to alternate between two loops
- How Do I Get My Post Tags to Alphabetize?
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- While loop articles – if statement order
- How to display all posts divided/ordered by post date? [closed]
- Why Query is returning empty array?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- Why are my paginated posts always returning the same results?
- Ignore latest two posts
- Is it possible to use WP_Query to only pull posts with attachments?
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Every second post different class in blog view
- Loop doesn’t exclude the specified category in home page
- Get posts with multiple categories
- Do not show children of a category
- Make a vertical dynamic list of posts in alphabetically order and in columns [closed]
- Display posts of specific category term
- Create a list of posts with topic headdings
- Widget that shows categories with posts numbers
- Print out last 3 blogposts
- why the same code got different results when using query_posts in functions.php and index.php
- Query posts by Author and/or by Tag
- Query for first 3 posts to change the look and feel
- How to get posts published on the latest date?
- Why posts array is empty?
- Can’t understand why sometimes a [caption] field appears
- Getting Duplicate Posts on Home Page with Widget Added Between Posts
- Page and post loop same template
- How can I add a box to edit Order on a regular post?
- Getting blog pagination to work on page set as front page
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- search blog posts by author first name and or last name
- Show metabox value last post excerpt, title and link
- On what hook can I get the queried object’s final state?
- unique post in “$args” of wp_query display more than one post
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- wp_query with ajax
- How to give classname to post if post has no content?
- Custom wp-query in wordpress rest api
- WP_Query: Show 10 posts in date order, first three random
- How can I insert a new markup element after 4 posts automatically? [closed]
- Exclude some posts from displaying in wp_query based on some condition
- posts_per_page returning only one post
- Custom posts listing widget always returns 1 extra result
- If no posts exist for current day and month, show the next available day of posts
- get_previous_post() while accounting for sticky posts
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to display post list in a table layout (multiple queries in single loop)
- Conflict array_splice on loop and query in widget
- Load widget only on blog posts
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Get all custom posts with a certain taxonomy