Yes, there is.
These are some WP functions to get, add and update post meta values:
Your code could be:
$meta_value = (int) get_post_meta( $post->ID, 'meta_key', true );
update_post_meta( $post->ID, 'meta_key', $meta_value + 1 );
Related Posts:
- Add options to featured image
- Change meta tags programatically
- Use a function to update post meta based on other post meta
- update_post_meta for custom field not working upon form submission
- Most efficient way to get custom database records from 20 buttons and 20 tables?
- Assign category using custom field?
- How to update BuddyPress xprofile fields programmatically? [closed]
- Convert User ID’s to User Names in a single.php file
- Best Practice for Syncing Local Development With Staging Development [closed]
- Is it good practice to use wpdb->query() function?
- Check if row exists before inserting
- Remove the deleted users avatar from list
- when I fetch data from remote mysql database in wordpress built in wordpress function is not working?
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- WordPress shortcode attributes for database SELECT?
- Move Post to different category if post_meta field is 0 or is 2 days old?
- Updating Media Published Date When Parent Post Is Modified in WordPress
- What WordPress function to use to get meta value by using meta keys?
- Default Custom Field Value Automatically Update
- Get User Login Data (date, time… )
- Multisite 404 on pages – rewrite error breaks database
- Post meta not updating
- Function to update post_meta based on existing post_meta
- Accessing two databases wordpress
- Connecting to a 2nd DB gives me no results when querying
- Exclude from the query posts with meta_key and meta_value
- Is There Any Built In WP Functionality For Combining Form Fields To Return Specific Data
- Prevent custom field from being updated after first publish
- Get array of metakey in all posts
- User function to return multiple get_post_meta()
- What are the meta fields for an attachment?
- Check if a value exists in database table
- wp_usermeta – Read from database, but save function broken
- How to avoid saving empty data to sql while using add_meta_box
- How to change text color depending on the number value (Using javascript)
- How to loop while adding data to database?
- How to add custom metakey to shop_order page’s searching function?
- How can I connect to a second database and still be able to use wp functions like get_post_types()?
- Writing a function for WP Cron to run a SQL command daily
- blank page with wp_get_attachment
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- Button click counter for login user
- How To Display Author Popup on Entry Meta (Genesis Framework)?
- Creating a “Related Meta” type field?
- Function stops working
- Remove post from latest posts after a month only with certain tag
- save_post doesn’t correctly process function call with php class
- Return ACF Field value function
- Database SQL Error, Should Work
- Database Query not working
- update_post_meta not working in function
- How To Get WordPress Categories Last Update Date?
- How to add a meta information to the URL?
- Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?
- Function to get the name in database table from the comma separated string
- update_post_meta after form is submited
- Add custom fields after post/page title
- Functions file mods and CPU
- Display post_meta-by_key on product catalogue
- How to save custom made object in an array in a post meta field
- Adding and updating repeating custom field meta data
- Bulk set Post Title as Tag where Tag is Empty Function
- Upload Multiple Files With media_handle_upload
- Add custom template page programmatically
- What is the difference between get_page_link and get_permalink functions?
- Woocommerce add to simple product attribute programmatically [closed]
- mysql custom wp query
- TinyMCE custom stylesheets for different post types
- Order get_users() by last login date. Is it possible?
- Display random text from a file with the WP built-in AJAX API
- Function to Download External Images to My Site
- How to call a function on particular page like ‘contact-us’ from function.php of child theme
- Detect Safari desktop browser and include the detection in a shortcode
- Is It wrong to use oop approach on functions.php?
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- Where do I add html code to the menu div?
- Add function to every post?
- Understanding and altering the structure of posted images
- How do I hide or remove ‘Category’ from wordpress breadcrumbs
- Trouble with adding a wp_enqueue_script on wordpress
- Display ‘BuddyPress Follow’ follow button to non-logged in users [closed]
- Get ID of first image attached to a post
- jQuery does not work
- Function naming convention
- debugging errors.. how to remedy?
- Where do i create my own function in wp-admin
- Question about “wp_deregister_script()”
- Output loop to function return?
- Combine embed_oembed_html and oembed_result
- Load JS file only in specific template
- video.js not enqueueing?
- Override a Post’s URL with Advanced Custom Fields Function
- Allow user only create specific tags
- Child theme remove parent filter in functions
- How to add number to wordpress count function?
- How do I integrate my Child Theme into a Custom Template?
- Why are some custom javascript files working but some are not
- Postmeta not saving
- How to display milliseconds instead of seconds using timer_stop function? [closed]
- Add functionality to block comment authors in the Comment edit pag