Not in core. You can use post meta to store this information on page loads. If you have caching plugins enabled, you might want to increment the hit counter with an AJAX call, otherwise you can just add this directly in your single.php and page.php templates:
//Add to functions.php
function get_hits(){
global $post;
$hits = get_post_meta($post->ID, '_hit-counter', true);
return $hits;
}
function update_hits($count){
global $post;
$count = $count ? $count : 0;
$hits = update_post_meta($post->ID, '_hit-counter', $count++);
return $hits;
}
//Usage within the loop
update_hits(get_hits());
Related Posts:
- Passing a parameter to filter and action functions
- Do deactivated plugins slow down a WordPress site?
- Allow all file types for upload
- Difference between a theme and a plugin?
- Update plugin from personal API
- Enabling free shipping on Woo Commerce by specific items [closed]
- Change Label for field used in Woo Commerce
- Symlinked plugin directory doesn’t appear in Admin
- How to disable Gutenberg editor?
- How to install plugins in individual sites on a wordpress network?
- Get Latest Plugin Version from WP API
- Let readers suggest edits from the frontend
- Disable plugins for a specific user role
- ob_end_flush error when using wpdb in plugin
- Need to include and redirect template from plugin
- Is it possible to uninstall one plugin from within another plugin?
- How to improve WordPress search
- Gurenberg Block: How to migrate from el-Functions to JSX elements?
- What is the purpose of the wp_enqueue_script() handle?
- From where come that JS files in ?
- Language Translation is not working?
- Enable/Disable WP options programmatically
- Could not create directory
- Hook before & after plugin / core update
- get_plugins() doesn’t work after plugins_loaded
- Getting user roles in plugin files
- Plugin and theme script load order
- How to import featured image using WP Rest API from another WP installation
- Shortcode button dosent work for all posts. Work for first post only
- New to wordpress: would like to have pluggable main page sections [closed]
- Single central login for front end users from any site
- Plugin stable tag on wordpress.org not updating
- How make a php script run only with wp-cron
- Plugin Handle URL With Custom Theme
- how to disable blockrenderAppender inside all Innerblocks?
- Where does the cookie mo_page_views_counter come from?
- auto populate list of questions if user select a category xyz
- Change commission_status paid when withdraw_status vendor is completed
- Grab WordPress Salt Data From URL
- Unable to get WP_DEBUG, WP_DEBUG_DISPLAY, WP_DEBUG_LOG to work
- Gutenberg: Block SelectControl saves attributes but after a reload of Gutenberg it loads its defaults. Why?
- Proper way to replace the_content only for pages created by custom plugin
- Add category selection to custom post type (plugin)
- How to install plugin only from PHP file?
- How to trace SUBMIT button
- Show author on every sub-page
- Only allowing some emails to create an account [closed]
- AJAX on Front-End Button Click not working – Custom Plugin
- Migrating Asp.Net site to WordPress site
- Can plugin2 uninstall plugin1 at the very beginning of plugin2’s installation?
- WordPress Book Exchange Plugin Equivalent?
- Get ‘Headers already sent’ error for the plugin I am creating when I try to login
- Plugin to email a post or page to someone
- My custom php file keeps 404’ing in WordPress when I call it. What am I missing?
- Return multiple values in a shortcode attribute
- Plugin temporary files and files to download via FTP
- How to extract a .wp-env.json or composer.json containing plugin versions from a production website?
- Search and Filter Plugin – How to disable redirection
- Make plugin php file called directly aware of WordPress?
- Using $wpdb in a plugin, what sort of data does it return?
- WordPress’s is_plugin_active_for_network function not working for multisites
- Next Previous Post in wordpress with previous / next link with title?
- How to use existing hook in twentytwelve to all theme of wordpress?
- WordPress get the latest plugin installed details
- After a manual update, themes and plugins that were installed (and still in the directory) are not being seen
- Recent Posts+, how to solve multiwidget?
- How to convert a plugin into a function
- Plugin error after installation
- Having a widget only show up in print
- Remove List Bullets
- How to set plugin auto-update Enabled by default?
- How to translate to spanish wordpress hardcoded content/files?
- Is there a tool to see every WordPress site that’s using a particular plugin?
- what functions to use to resize images and create DB metadata for them after/during upload?
- How to Create a Learning Management Plugin in WordPress to Manage Courses [LMS]
- Overwriting Plugin’s Ajax callback function from theme
- How to disable users to view Other pages
- How can I get the Post ID and Post Type within a Must Use Plugin?
- Can’t find variable is_single in my jQuery plugin
- WordPress Cron function is not working
- How to do rest APi with wordpress
- SSH vs WordPress
- WordPress Dashboard organize posts based on categories
- Find all strings between an enclosing shortcode
- Showing ads in the specific category and its sub-categories
- Plugins upload to wordpress in wampserver via filezilla
- Having trouble initializing wordpress within plugin
- Related posts popup
- Get content or excerpt of top rated votes @GD-Star Rating? [closed]
- Problem with permissions in wp-content/plugins
- What would cause edit buttons for plugins to disappear?
- Is an Office a custom post type [closed]
- What is the best way to change share image for social networks? [closed]
- Duplicator live to wamp https to http
- Woocommerce quick checkout form [closed]
- Plugin Beauty Contact Popup Form with while loop
- I am experiencing difficulty fulfilling client request
- PHP Creating a formula from mysql db values and db stored math operator
- add_meta_box showing blank screen in my page
- Plugin translations are not loaded from translate.wordpress.org