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
375 views

Catch and display error on save_post action

I wrote this function that adds data to an external db every time a custom post called 'event' is created. How can I prevent the save from happening if this function returns an error? At the moment, ...
0
votes
1answer
92 views

Perform function on publish AND save (not just save)

I am using this function to auto-set a post title based on a couple of custom fields: function set_event_title( $data , $postarr ) { if($data['post_type'] == 'event') { $getdate = ...
0
votes
2answers
553 views

'save_post' hook not working in WP 3.5

I used to have an extra option added to the 'Edit Media' screen (using the attachment_fields_to_edit hook, and then saving with attachment_fields_to_save). However, I've updated to 3.5 today, and the ...
0
votes
1answer
95 views

How to get changed post title in my custom plug-in which fires when 'save_post' is called?

I created a custom WordPress plug-in that hooks onto 'save_post" using add_filter(). I need to do something with the post titles and whenever a user changes the title, my plug-in cannot get the new ...
0
votes
1answer
308 views

Check for page template on save_post hook

I'm reading into the save_post Codex and I find that you need to check the $_REQUEST['post_meta_data'] in the edit window to hook into save_post. I altered the example code: function ...
0
votes
1answer
596 views

How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]

Title: How to create a front facing user sign up, log in and profile pages like FoodGawker.Com Body: Hey everyone! I'll be as direct and detailed as possible. :) I want to be able to sign up ...
0
votes
1answer
129 views

Secure way to use name_save_pre?

I created a custom post where I need to change the post name regarding to the custom field and taxonomy values. This is how I did it: add_filter('name_save_pre', 'save_name'); function ...
0
votes
1answer
115 views

Bug: Post needs to be updated twice when adding action for save_post hook

My function does exactly what I want it to do: I'm trying to add/update meta fields in another post type when an "events" post is saved. Except the post needs to be updated twice for the information ...
0
votes
1answer
945 views

Custom Post Type Meta Box Text Input Field Won't Save When Blank

I have some text fields in a custom post type that I fill in at first, but need to delete on a future update of the post. When I delete the text in the field and save the post, the text I deleted ...
0
votes
1answer
507 views

unable to save custom taxonomy terms in a custom-built metabox in wp-admin

I have created two custom taxonomies i.e states and provinces but am unable to save the data in custom build meta boxes in wp-admin: <?php function custom_meta_box() { remove_meta_box( ...
0
votes
1answer
1k views

prevent post submission

I'm using a meta-box for custom post type. I have three problems: WP seems to run the function that I attached to the "save_post" action, every time a new post is opened for editing or reloaded. Is ...
0
votes
1answer
485 views

save radio button selection in post-meta on submit

Right now I'm reading tags from the tag box, and putting them in a form with radio buttons so the user can choose a "main tag" from the tags they just typed in: function write_tags(){ var rawtags ...
0
votes
1answer
297 views

Is it possible to detect if a POST action is for a “Save Post” before the save_post action?

What I need to do is inspect the content of the post and title and based on the inspection, redirect to a different page. To do this, I need to know if a "POST" action is for saving a post. How to ...
0
votes
3answers
1k views

troubles with get_post_meta (and saving it)

im having trouble using "add post meta" and "get post meta" : i have a new meta box in my taxonomy : i always have the value "empty meta" inside the input field, even after i enter anything : like ...
0
votes
1answer
306 views

help intercepting save_post through plugin

I use stackoverflow very often and just found out in google about this one, Nice :D Well, i want to save my every post i write from wordpress to my 3rd (OEXChangeble) website aswell at the same time, ...
0
votes
0answers
29 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
23 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
63 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
30 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
42 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
35 views

save_post action not firing due to old page_template meta data

I have some functionality hooked to the save_post action that wasn't working for a user on a particular WordPress Page. After some digging I found that wp_insert_post() was returning before getting ...
0
votes
1answer
41 views

save_post not called in plugin / custom field still saving overwriting metaboxes

I have a plugin that writes metaboxes to certain pages. It writes the metaboxes fine and everything works as should...until I save. The save_post is not getting called, and I can't figure out why. ...
0
votes
1answer
63 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 ...
0
votes
0answers
97 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
1answer
236 views

How to store the value of a custom field dropdown select for post referencing?

I'm trying to reference posts to each other. Editors should have a custom field select list of certain post's titles to link the current post with other posts. I got quite far, I think. The select ...
0
votes
1answer
252 views

wp_insert_posts Fatal error: Maximum function nesting level of '100' reached, aborting!

I'm having a weird problem I have written the code as below: add_action('save_post', 'save_post_func'); function save_post_func(){ include_once(ABSPATH . WPINC . '/feed.php'); $rss = ...
0
votes
1answer
24 views

get categories the post was in and just been removed from

I have a function hooked to the save_post hook. this function is mostly concerned with the categories that the post is in. My function does the following: function post_save_hook($post_id){ ...
0
votes
0answers
81 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
1answer
116 views

How to change the post author when the post is published?

I wanted to change the author when a post change from draft to publish. I have $_GET['auth_id'] variable in post edit screen like this ...wp-admin/post.php?post=53&action=edit&auth_id=5. I ...
0
votes
1answer
97 views

save_post action not firing when save

Below is my code that will take the post_id and randomly get 3 posts from the same category and store them as custom field. The code is clearly working, because when I click "New Post", I see the ...
0
votes
0answers
87 views

post_content not parsed using save_post action hook

A site I'm building for a client has to be able to download Vine's to a server when they've been posted using a shortcode ([vine id="..."]). This works fine for my local install (it's a Multisite ...
0
votes
1answer
139 views

How to get post bulk edit action trigger and get edited post ids?

I want to send email if a postmeta of a post is changed to the expected value.So previously i was doing loop to check the post meta in each post. In here am running the loop in admin_init hook. But ...
0
votes
0answers
50 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
1answer
47 views

About WP's save_post action

Quick question, in API's some times save_post is used(most of the time actually). Is save_post the equivalent of the query action INSERT INTO whereas save_post saves metadata and forces Wordpress to ...
0
votes
0answers
14 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
342 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
31 views

Deregister or disable duplicate check ($post_exists) in cpt saving/updating process

I have registered a custom post type which is ment to bring up 24 posts a year, titles only containg numbers 1-24. I did some rewrites to achive that the permalink structure of this posts will be ...
0
votes
1answer
37 views

Insert/Update DB table when making new post or update older one

I was wondering how can I insert a DB row (not related to WordPress tables) only when I update or add a new post. Right now I have this... add_action( 'save_post', 'insertIntoDBatPost'); function ...
0
votes
0answers
74 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
1answer
437 views

Execution of JavaScript on save post

I got stuck with one problem, can somebody please help.. :) I would like to execute custom JavaScript function before post is saved, and i can't find how to do that. Something like JavaScript version ...
0
votes
0answers
72 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: ...
0
votes
1answer
78 views

How to save post change url youtube link?

In functions.php i using this to change width url from youtube: add_action('save_post', 'set_url_youtube'); function set_url_youtube() { $post = get_post($post_id); $content = ...
0
votes
2answers
148 views

save post running twice and creating two database entries - how do I disable this?

I am developing a job tracking database for my utility engineering company and am having an issue when running a save hook. I have a task_types db table that tasks are created off of and using a ...
0
votes
2answers
43 views

Prevent Page/Post From Being Created based on Pages/Posts per User per Time Unit

I'm working on new project and I want to let users have access to create pages on the site. To prevent users from "spamming" a lot of pages, I'd like to set a daily upload limit for each user. I've ...
0
votes
1answer
141 views

How to debug | Some times the “Save Draft” button seems to spin but does not actually save

I am using wordpress 3.5.1 and lately there seems to be a recurring problem with the save draft function where it seems like the draft was saved (i.e the wheel finishes spinning without an error ...
0
votes
2answers
187 views

Problem with executing a function on saving a post

Here is my basic plugin code. I am just starting from scratch. I will explain the functionality. It is simple, While my plugin is active it will add a new meta box in add new post page just below the ...
0
votes
1answer
405 views

save_post action inside a custom metabox class not working

I am writing a class to create metaboxes and save the form data. The problem is, I keep getting a warning when I click "publish": Warning: call_user_func_array() expects parameter 1 to be a valid ...
0
votes
1answer
126 views

Saving zero as meta value

I have a meta_key called "_ordre" and each time I create a new custom post, a new meta_value is set for that meta_key. The thing is, when I set the value of '_ordre' to 0, the meta_value is not saved ...
0
votes
1answer
100 views

added a meta box to post however when saving menu while debug on throws a warning

I've added several meta boxes to post and the function that suppose to save those boxes. When i save menus ( appearance -> menu). it throws a warning for each added menu or sub menu Notice: Undefined ...
0
votes
2answers
1k views

update_post_meta() not working in save_post

I have added some text input fields to metabox in my custom post. Now whenever I put some data in those text fields in admin panel and click 'save', all data vanishes. Here is the code: <?php ...