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
- How to get post ID of the current page/post inside a widget?
- The next_posts_link() works only with original $wp_query
- Adding additional data to WP_Post object
- Different post sort order within different categories
- Query *only* sticky posts
- Skipping first 3 posts in wp query
- Query posts from current year
- Set number of article per number of page
- Get only modified posts
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- Order post by year DESC and month ASC
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- orderby=meta_value_num creates duplicate posts
- Change Order of Admin Posts Depending on Meta
- posts_per_page doesnt work
- wp query with dynamic taxonomies and terms?
- Display posts in alphabetical order for a particular category
- How do I use `posts_distinct` correctly?
- Automatic value for custom fields for posts
- Improving WP_Query for performance when random posts are ordered
- Why won’t my taxonomy query show up?
- How to find what index page a post is on?
- Get Posts that are in the current month or later
- WP Query to Get Array of Slugs
- WP_Query with ajax handler returns the same posts
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Hiding Draft Post In Admin
- How to insert 2 args into 1 Wp_Query for a slideshow
- How to verify wp user password by sql query in wp? [closed]
- Sort WP posts by span value
- WP Query – Posts Per Page not working in combination with category__in
- How to sort posts inside categories
- remove post and categories/tags count from right now dashboard widget
- Query Posts by Custom Field
- how can i change WP main archives loop to sort by name or title
- Using wp_list_pages() after calling query_posts()
- Why are my paginated posts always returning the same results?
- Loop doesn’t exclude the specified category in home page
- 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
- 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: Show 10 posts in date order, first three random
- Exclude some posts from displaying in wp_query based on some condition
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- How to convert query sql to shortcode in wordpress?
- Sidebar limiting to 10 posts?
- WP_Query get posts in custom database table [duplicate]
- WP query taxonomy optimization
- Custom Fields – How to get the list of a specific active widget each time it rendered
- Change Old WordPress Post Date Year
- Displaying all posts from other sites on the network on one site
- Multisite how to display merged posts from two sites and sort by latest date?
- Query prints posts without specific categories
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- post__in no longer works in wordpress 5.0.3
- Using a meta_value or postdate to to query and orderby
- Exclude posts in home slider from sections
- Ajaxify Post Sort
- Manipulate query to show specific post
- Get current user, change users post status to published
- Posts on Sidebar only
- How do I create a ‘selection’ criteria list’ that will then dictate which posts are generated when the user presses search?
- How to display most popular posts from certain category in sidebar?
- Display WordPress Post By Date
- GUID to related post not in current language
- How can I display a specific number of post in a category via a url
- Hide first blog post in content and output it in widget
- Advanced Post Display/Pagination/Ordering
- Query category-specific, paginated posts and allow viewer to change sort order
- Make assigning post to a specific category equivalent to assigning it to all categories
- Multiple loops on a Search result page?
- How to use in_category?
- WP_Query retrieve custom posts but not the post showing
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- WP_Query based on a custom field result
- How to have more post in a page than in your home page
- WP_query sort by custom meta_key “price”
- How to create a cumulative posts and members count
- How add class the_content();?
- Add custom PHP (no-SQL) filter to WP_query
- How do I get content of custom post type through post ID
- How to speed up WP_Posts_List_Table __construct() Query on a wordpress website with over 1 million posts?