save_post is an action triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. The data for the post is stored in $_POST, $_GET or the global $post_data, depending on how the post was edited.

learn more… | top users | synonyms

2
votes
1answer
665 views

save_post hook not triggered in WP v3.6.1

I developed a plugin having a custom metabox that is using the save_post hook to store data. The plugin is 18 months old and is used by thousands of customers, so I'm pretty sure everything is good. ...
1
vote
1answer
62 views

Execute action after post is saved with all related post_meta records (data)

I have to execute custom PHP code after new post is saved with all it's meta data. My question is how to achieve that? Tried with save_post action, but it executes before meta records are saved, so I ...
1
vote
1answer
148 views

Saving Custom Field Data before Publish

When creating a page or a post WordPress lets the content (title, body, featured image) be saved when using Ctrl + S. The Custom Fields do not save in the same way (in this case I'm using Advanced ...
1
vote
1answer
422 views

non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue

I registered a non-hierarchical custom taxonomy ('property_features'). There is a checkbox for every terms of this tax in a custom meta box on the edit-screen. All terms are displayed and all terms ...
1
vote
1answer
648 views

pass error to admin_notices on “quick edit”/save_post action

I currently have add_action('admin_notices','my_notice_function'); updating correctly whenever a page is refreshed (it's checking if a certain page has a certain parent) but when using the "Quick ...
0
votes
1answer
34 views

How can I edit comment meta value before it is saved?

I have introduced a custom field in comments form using add_comment_meta() function. I would like to know if there is a way to edit the data of the comment meta just before the post data is saved so ...
0
votes
1answer
12 views

WordPress save_post hook not firing when checking if _GET['post'] is set

I was facing an issue (a custom metabox not saving), and after 2 hours I finally realised that, if you try to add an action to the save_post hook inside an if statement checking whether $_GET['post'] ...
0
votes
1answer
12 views

Custom metabox does not store data

I'm troubled with a custom metabox, could someone give me a helping hand? I've got a custom post type which uses it, but unfortunately it's not storing the data into the database. Any clue? ...
0
votes
1answer
16 views

Why WordPress takes time to make request to save post?

I have around 50 post meta fields, each meta field have different values. I have noticed when saving posts, it takes around 3 to 4 seconds to make request. Why?
0
votes
1answer
27 views

WP_Query within save_post doesn't include the item that triggered the action?

I'm using Advanced Custom Field's acf_form function to expose a front-end form for users to post content on the website. Users will be submitting photos of redfish they have caught, and one of the ...
0
votes
1answer
29 views

Generate slug and meta data if meta field is empty

I am creating a current vacancies feature in a client site, and am struggling on one area. I want to have a slug generated from a reference number, rather than the post title. This, I have set up. ...
0
votes
1answer
27 views

Cant't delete my custom posts

I added this code in function.php in order to replace post_date with an ACF field every time i update mu custom post. It works perfectly ! BUT Now in WP admin i can't delete (to trash) any custom ...
0
votes
1answer
59 views

Why does post-slug not get saved for drafts?

I am trying to get the value of the 'new-post-slug' (the bit that you can edit to customize your slug for a post, but bizarrely doesn't have a 'name' attribute as you'd expect a form field to have ... ...
0
votes
1answer
95 views

Checked() function on a multidimensional array

I am generating checkboxes dynamically on one of the option pages. This the code that I'm using to create multiple checkboxes: <?php foreach($shopCategories as $shopCategory) { ?> <input ...
0
votes
1answer
41 views

flush_rewrite_rules on save_post does not work on first post save

I am developing a plugin for my own rapid development that creates a custom post type. The 'list' for this post type is displayed on a specific page that is created and managed by the plugin. This ...
0
votes
1answer
82 views

post_title in save_post action

I use save_post action to save meta field and to check if post title is set. So I check the value returned by empty($post->post_title) but I get true also if I set the title.
0
votes
1answer
52 views

Editor meta box Showing but not saving

I am trying to create an editor meta box and I have been following tips found in other similar questions without luck in getting the meta box to save and display its content. The meta box shows but ...
0
votes
1answer
123 views

Save data of select list after clicking save

I already have a meta box in the edit post that has a select list with custom taxonomies. But after i save the post the select list returns it value to none, so i don't know how to save the selected ...
1
vote
0answers
26 views

publish_post conflicts with save_post

my plugin has a save_post hook used to save the custom fields. now I add a publish_slider hook used to change a checkbox's status(slider is a custom post type). but it doesn't work properly. the ...
1
vote
0answers
17 views

CPT Validation to not show “Post updated.”

Now this has been asked several times over on all WP forums, but how you change the success message? First, I know there are 2 choices for managing the error message: setting in the options and using ...
1
vote
0answers
66 views

Update post meta using save_post hook in multisite

I am trying to update a post meta field in a custom post type in Multisite. i am using the save_post hook to do so unsuccessfully. I don't know if the reason / cause is the multisite? or wrong use of ...
1
vote
0answers
163 views

Wordpress custom admin notice still displays after wp_insert_post_data validation

I am trying to validate post data before saving, specifically checking to see if an image exists within the first 750 characters of the post content. The code below works and display the admin notice ...
1
vote
0answers
250 views

How to notify specific users when i'm posting/modifying a new post

Here's what I'm trying to do... I'm trying to send new submissions only to contractors requested. Using Role Scoper, I can select only users who can access the new submission. However, I am looking ...
1
vote
0answers
112 views

Events: Check for other event with same start date and category

I am using The Events Calendar and (correct me if I'm wrong) there is no checking to see if an event has a time conflict with another event that's already been entered. For example, if there is ...
0
votes
0answers
13 views

Page content not saving, can not save page content

I'm trying to figure out what's wrong with the page editor at my wordpress installation. When I create a new page and insert title and content, the title is being saved but the content field turns ...
0
votes
0answers
24 views

create a form and save data into new table

I want to create new form to add my customer details including name, email, contact num, address Once created, this form should store all these values into newly created table and also generate 4 ...
0
votes
0answers
35 views

How to manage saving custom field from Quick edit and Post Save using save_post action hook without colliding each other?

I's following Rachel Carden's tutorial on creating Quick Edit and Bulk Edit, and grabbed her full work from her github repo. I managed doing everything fine and I made a checkbox instead of radio ...
0
votes
0answers
26 views

Check if value has changed on save_post

Writing a function to send an email to the user on save_post if a taxonomy equals a specific value. However, I only want this to happen when the value is being changed, and not on every save. Is there ...
0
votes
0answers
19 views

Woocommerce conflict with new “submit_button”

I have replace the submitdiv meta box (publish box) with just one simple save button. All working fine with post/page and custom post type (plugins that i have install that create custom post type). ...
0
votes
0answers
18 views

How to add a div area inside post edit page after Publishing or updating a post or page

I am trying to create a div area when i update or publish a post function my_save_post_function($post_id) { echo "<div class="default">Hello</div>"; return $post_id; ...
0
votes
0answers
22 views

Replacing Standard Category Metabox

I am rewriting the standard category metabox to include a Custom Field as a select box which is dynamically updated as the user chooses the categories. This select box is set with all "checked" ...
0
votes
0answers
19 views

Detect current user during save_post or post_updated

I have a function, hooked to the save_post ( post_updated ) action. I want to detect who is the user saving ( updating ) the post?! function my_fun(){ global $user_ID; $user_info = get_userdata( ...
0
votes
0answers
13 views

Triggering a task to a queue upon saving a custom post

Here's my ideal scenario for the use case I'm exploring. 1.) user creates a new custom post type record with a bunch of custom fields. One of these is a url field. 2.) upon saving the record, I'd ...
0
votes
0answers
82 views

Problem with 'save_post' hook not running

I have a custom post type, with a custom meta box which contains a number of input fields. The meta box is displaying fine but when completing all the fields the data is not saving, in fact, the ...
0
votes
0answers
13 views

Excerpt text not showing in meta box, causing flush on update?

I've created a custom post type that supports excerpts. On a post update of this custom post type, the content in the textarea for the "Excerpt" meta box is saved, however it isn't output into the ...
0
votes
0answers
32 views

Post Meta Checkbox won't save

I'm trying to use the script as per How set featured posts using checkbox in post edit screen? function register_post_assets(){ add_meta_box('featured-post', __('Featured Post'), ...
0
votes
0answers
73 views

Data in Metabox Text Field Not Being Saved

here i have a custom post for events and every thing is fine except for once custom field (events location) in the metabox .. Here is the code . Any help would be great . and much appreciated. ...
0
votes
0answers
120 views

How to pass error message from plugin function to admin_notices

I am creating a WordPress plugin that uses the save_post action hook, and need to output any error messages to the screen (I am using the admin_notices hook). The setup is like this: function ...
0
votes
0answers
105 views

A correct hook for saving meta boxes data

Nothing happens when I do the var_dump() in a callback on post save. Here are the hooks I've tried: save_post as shown in the codex pre_post_update as suggested here wp_insert_post_data found in ...
0
votes
0answers
39 views

save_post is not firing when I only edit custom meta fields

I've come across the action hook save_post few days back and I like to take advantage of it. I've custom post post type "Property" with Meta fields associated with it. The problem is that when I ...
0
votes
0answers
127 views

Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update

am using this code to create a Metabox for CPT. Now I am able to view the updateded / saved Text input on post but the Checkbox and selected options return null after save or update. Can you please ...
0
votes
0answers
52 views

wp_set_object_terms bugging

I'm working on a plugin where I set custom terms for posts on save. I use the save_post hook. It all works fine except when I for example also change the title of the post, the custom terms setting ...
0
votes
0answers
129 views

unwanted redirect on saving custom post type / custom post not saving

I've added (or at least attempted to add) a custom post type that has a custom meta box allowing a file to be attached to the post. This function has been spotty at best, allowing some files to be ...
0
votes
0answers
155 views

Meta data not saved on save_post

When I try to save my post after inserting it via an external php script, it returns my the post id, but it's not able to retrieve the post meta created in the database. I am getting an array having ...
0
votes
0answers
151 views

Saving metadata of related post on save_post

here is the scenario: Custom Post Type "shows" Custom Post Type "reviews" Reviews are "child" of shows so that every review has a custom field with the ID of the parent "show". Since a review has ...
0
votes
0answers
73 views

save_post hook frustration

Clean 3.8.1, clean Twenty Fourteen theme, no plugins except for my own custom one. The main plugin PHP file only has a single "require_once('test.php')" And "test.php" in its entirety is: ...
0
votes
0answers
18 views

Disable a function from executing in post.php

I have a function that seems to execute on saving a post (post.php) and I would to disable it from executing then. I don't know how to specify that? I could check if is_admin, but that would disable ...
0
votes
0answers
670 views

Function that get ACF fields value before saving

Rewrited question: There is a similar question HERE but I don't know how to combine it with my code. I have a function that relay on acf checkbox field. It is working fine but I have to update the ...
0
votes
0answers
92 views

WP Infinite loop

It is not working. add_action( 'save_post', 'jdev_save_custom_meta_box', 13, 2 ); function jdev_save_custom_meta_box(){ global $post; // Get our form field if( $_POST ) : if ( ...
0
votes
0answers
75 views

wordpress meta_box data don't save

I made this metabox with an input item and two select items(a dropdown and a checkbox). When i write something in the input item or i select something it disappear when i update the post. Another bug: ...