Try using save_post
hook instead.
Check this example:
https://gist.github.com/fgilio/38dfbf9d03654b21302a
Related Posts:
- WordPress Scheduled Event Request Blocking
- Accessing the database from a plugin outside of action hooks
- Update results, Before deleting the related category [closed]
- Store a default value for a transient on plugin activation
- Execute long and heavy processes
- wpdb prepare insert table doesn’t work
- Building a REST API for your web app exposes primary keys of DB records?
- Set default Database Storage Engine when creating tables with plugins?
- How do I make this Metabox show current DB value?
- select a single val though a table in wordpress
- code that I can run, or a plug in to show what sql tables something pulls information from
- How to edit the default database of WordPress [closed]
- Create custom table for wordpress custom registration flow
- what is the use of /wp-includes/SimplePie?
- How To Make Connection To WordPress Data Base In A Plugin?
- How to use a frontend URL with a Plugin
- How can I call a row of user specific data from a custom table added to the WP Database
- How to track a users progress through pages by inserting data into WordPress Database?
- WordPress template_include filter not working properly
- Theme url in all plugin pages
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- How to display a value from a radio button in the options menu in wordpress
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- How to call function at the bottom of post using plugin?
- Prevent Data Resubmission On Page refresh
- SQL QUERY – Select a value directly from the database
- WP add_action factory
- Transferring working local PHP site to wordpress – with database (MySQL)
- Swapping wp_dropdown_categories function with wp_category_checklist
- How to show phpinfo() only in a new tab?
- Getting id of poll from WP database
- How can I remove a function that has been added to wordpress with add_filter?
- How does WordPress know wich language is chosen when there is a database connection error
- How to use $_GET function WordPress backend
- Dynamic content in template
- Extend PHP regex to cover “srcset” and “style” attributes
- How can I hide that I Use WordPress (with W3 Total Cache)
- Saving plugin settings – ERROR: options page not found
- class_exists returns different values [closed]
- Asynchronous multiple requests 401 Unauthorized
- Custom array from a query only write the last row of the query
- WordPress Block developer from exporting Database via PHP
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- What does -> mean in WordPress?
- How do I display offsite database info on my wordpress site?
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- How to add the sidebar to all the pages except the home page? [closed]
- Custom meta box values are not getting saved for my custom post type
- Most commented posts by time period (last 12h, last 24h and etc)
- Can’t upload CSV file to plugin directory using custom upload form in admin panel
- Validate and Sanitize WP REST API Request using WP JSON Schema?
- Can I remove or edit an include() from a function with a filter?
- Call to undefined function error in plugin
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Get category id when SEO URL is turned on
- Unserialize Custom Field & Save as Multiple Rows in WordPress Database
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Using ACF Relationship field to set post type to draft or published status
- WordPress can’t use ZipArchive
- How to extend SelectControl with data from my theme
- $_POST returning empty values
- How to send custom form submissions to WordPress Database?
- WordPress loading progess – wp-blog-header.php
- How can i avoid duplicate same post in wp?
- How to identify which php file a plugin is using on page load?
- dashboard widget form not submit mails
- register_setting not save checkbox
- why not selecting multiple rows of same standard_id using SQL query from database?
- How to import woocommerce custom fields data into another site?
- How does one make a URL return dynamic JSON with custom Content Type?
- How to give custom roles the capability to edit one Menu instead of every Menu
- getting the values of hidden inputs to use them in a php mysql query
- wp-login.php?redirect_to=https problem
- add menu page in loop menu order
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- Private messaging – Getting and displaying the avatar/url of a message recipient
- global $post inside plugin query messes up every new post page in wp-admin
- wp_query (or hook) posts by date (id) in array then set post_type
- Chosen Select jquery Not Working in Plugin
- widget: input the px value from user and use it as inline style in widget function
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- AJAX Not Working With WordPress Database properly
- Custom post type single page return to listing page
- Manipulate database of WordPress site with my own scripts
- Problems with plugin that fetches data from database with ajax
- WordPress rewrite question
- Using Nonce for my Form
- Create new folder and upload files to custom folder via wp_handle_upload
- How to pass username into form that sends data to database
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- How to hide Ads From Certain Categories?
- Insert into db with foreach problem
- Implement OAuth2 in custom plugin
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to lock users account until approvation
- Variable ++ in query loop
- WordPress REST API – Custom field not added to pages