Use something like this : (add it in your function.php) and load your site once. after it finish, deactivate the function. (don’t forget to declare your $postID)
function my_update_posts() {
$count_key = 'post_views_count';
$args = array(
'post_type' => 'post',
'numberposts' => -1
);
$myposts = get_posts($args);
foreach ($myposts as $mypost){
$mypost->post_title = $mypost->post_title.'';
$count = rand(700,999);
update_post_meta($postID, $count_key, $count);
wp_update_post( $mypost );
}
}
add_action( 'wp_loaded', 'my_update_posts' );
Related Posts:
- How to show post views on single.php page?
- How to improve post views count display?
- Show number of views in the last 48 hours
- How to remove the Unattached filter on Media Library List?
- Showing “0” pageview when there is no view
- How to reset post views count
- How can I create the number of custom post views
- Readers can’t view my pages/post whitout logging in?
- How can I make post view count editable? [closed]
- how can view all three subcategory in same line(found ex: and code)
- Display (custom) post number of views
- Updating post_views_count on publish [duplicate]
- Post rank by views
- Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy
- Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy
- What is the difference between a stored procedure and a view?
- select * from table where column = something or, when unavailable, column = something else
- Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type
- How to Change Loop to Order Posts by Views (using wp-postviews plugin)
- Custom Post Type With Different Views
- Creating a custom MCE view for your shortcodes [closed]
- WP Admin default view mode for Custom Post Type
- Writing a view count with w3 total cache
- Popular posts by view with Jetpack
- Increasing post view count automatically [duplicate]
- Add link on the top menu of the post table?
- Display posts from Last 24 hours and order them based on most views
- Show post titles only on the homepage
- Tinymce shortcodes within shortcode contents
- Counting pageviews on high-traffic cached sites
- Change post category based on latest posts views
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- How to add “time” data this?
- Double count view in archive.php
- Sorting posts according to view counts not working
- Show content from database
- Make view count for pop up post
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Create a list-style post of popular posts for the week?
- How can I count post views of REST API calls and update them in an ACF field?
- Custom view counts not updating correctly
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- WooCommerce Grid / List view
- How to find time last viewed?
- How to display post view count by date, week and month?
- Get .subsubsub count of post per status queried using pre_get_posts
- How can I get global $post to work for CPT and update user?
- define orderby URL with meta_key=post_views_count
- Does wp track views for posts?
- How to display number of page views on a post?
- sort post types by amount of views
- Count category views – Is it possible?
- How to keep variable `$post` to using in another file
- Get total views of all posts by author
- Post Views / Hit Counter Problem?
- Searching for meta_key returns 0 posts
- Count post views in loop
- Check if post id exist in table than only update instead of inserting new row
- Display a list of users who have viewed the post you are viewing
- How to unlink all posts from tracking same amount of views
- restrict incrementation of post vies count when refreshing the page
- How get top post view for today for today post
- Getting shortcode attribute values and shortcode content with JavaScript regex
- Embed PDF into wordpress
- count the number of views of a post excluding own views
- an action hook when a post reaches a certain number of views
- Posts being viewed
- Post Views Code Hacks
- show most viewed posts of last days by link?
- sort posts by getPostViews in functions.php
- How to sort a loop after most viewed
- Count the total views of all user posts published
- Best way to fix bad count on All | Mine | Published
- Why “Mine” is the default view when adding ‘capability_type’ in register_post_type
- How to show post views shortcode data for each post on Posts List Page?
- How can i show post views using specified post ID?
- How to fix blog article view and share #’s?
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- view counter update in WordPress REST api HTTP get
- Author.php Page views counter
- How to Display Most View Post in the template file?
- How to display total views of all posts of one category?
- To remove rendering of menus and header, plugin or theme?
- To remove rendering of menus and header, plugin or theme?
- How to display most popular post by views count in WordPress?
- Pageview all of sudden not working
- Count how many posts a user has viewed
- how to localize the number of wordpress post views?
- How to show total view count across all posts for an author
- Get users query makes the site loading time too big?
- Remove pipe in views admin page filter
- Changing comment_count to views
- Integrating CSS Into a WP Function Call [closed]
- Get taxonomy image for Toolset custom taxonomy through Toolset Views Shortcode
- Remove ‘portfolio’ from URL