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

0
votes
1answer
8 views

Update post_meta post_name with the post ID from wp_insert_post after user register

I'm creating a function that creates a page for a user when they register. The post created sits within a certain category. These are standard posts NOT custom post types. After the post is created I ...
0
votes
1answer
35 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
14 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'] ...
1
vote
2answers
33 views

Returning ACF custom field from publish_post

I'm trying to return a custom field as soon as a post gets published. I'm using the publish_post (or {status}_{post_type}) action, but it looks like the custom fields are created after the hook. My ...
0
votes
0answers
14 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
28 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
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? ...
1
vote
0answers
14 views

How to change the attached image's name after save post? [closed]

I would like to let the user upload images with any name, and automatically modify their name to the format as %post_id%-01, %post_id%-02, %post_id%-03... when save post. And I'm using the plugin ...
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?
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 ...
0
votes
0answers
37 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
27 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 ...
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
69 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
1answer
63 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 ...
0
votes
1answer
51 views

duplicate entries in database while using save_post or wp_insert_post

Here is what I am trying to do - I have created a custom table in the database and I am trying to enter data into it everytime a post is created. The database-entry needs to happen ONCE AND ONLY WHEN ...
0
votes
0answers
20 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
1answer
28 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
13 views

Conditional for autosave or auto draft?

I am attempting to create a file using fopen() on save_post. I am having trouble finding the right condtionals to prevent the the file from being created from an auto save. I only want to create the ...
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
2answers
44 views

Connection Reset on post/page save

I'm working on a client's fresh install and server. Every time I attempt to save a post or page, I'm immediately sent a connection reset error (This webpage is not available - ERR_CONNECTION_RESET). ...
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
55 views

Post meta checkbox becomes unchecked occasionally

I removed the default author meta box on posts and added it back with a checkbox that I use to determine if a post should show the author's byline and author box. It's been working, but for some ...
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
0answers
23 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" ...
1
vote
2answers
134 views

save_post action to include wp_insert_post_data filter, gathering meta field info & prevent infinite loop

Im trying to change the title of a post, but I want to include info from a meta field, the value of which isn't saved to the database until after the posts has already been saved. Other than this one ...
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
1answer
63 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
98 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
99 views

Set default Custom Post Meta Value

I've tried almost anything and just can't get this to work. I have a custom post type with a custom meta field and I want a default value to be added on when the Publish/Update/Save button is ...
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
85 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
1answer
63 views

Class property seems to lose scope, attached to save_post action?

This may be more suited for StackExchange, so if you think that would be the right place to direct my question - please let me know :). So, I have a class with a property of save_list. This is an 2D ...
0
votes
0answers
14 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
1answer
29 views

Metabox of one post influence setting on other

This great answer by David Gard allowed me to have a metabox sticky (checkbox) for posts that could only be set (checked) on one posts in the loop at a time. If post A has that meta box checked, then ...
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
74 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
122 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
1answer
84 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
218 views

“Notice: Undefined index:” error when adding new content?

I'm getting the following error... Notice: Undefined index: album_tracks_metabox_nonce in /Applications/MAMP/htdocs/TheToasters/wp-content/themes/Toasters/discography-post-type.php on line 124 ...
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
0answers
108 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
40 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
129 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 ...
3
votes
1answer
109 views

Is it possible to save/modify a post without calling the “save_post” action hook?

There is a save_post hook that is run when you save a post. In fact, revisions and autosaves also call this hook. Even if you simply change the status from published to draft it triggers the save_post ...
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
130 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
2answers
35 views

My custom title gets duplicated at every save or post update

I have a problem, my custom title keeps getting added at every time I save the post.. First I created a Custom Post Type called 'imac' plus a front-end form for posting in this Post Type, only before ...
-1
votes
1answer
149 views

Save post to category with gravity forms (post_data) [closed]

I'm trying to save my posts, generated with gravity forms, to a specific category. However whatever I try, it's not working. The post must be saved to sepecific category, dependent from a gravity ...