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
21 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
0answers
12 views

add_meta_box issues

I have the following code in functions.php: add_action( 'add_meta_boxes', 'create_meta' ); function create_meta(){ add_meta_box( 'Session details', 'Details', 'create_details', 'portfolio', ...
1
vote
4answers
370 views

Updating wp_options with an array on save_post results in duplicated entries

I'm not entirely sure this is Wordpress' fault, but I figure I'd ask anyway and see if anyone else has experienced any problems like this before. I'm trying to save an array to a wp_options table ...
0
votes
1answer
20 views

Second select list values are not saved after clicking update

I have a select list in a metabox which value is saved successfully after clicking "Update" when editing post. Of course, the values are custom taxonomies. But i don't know how to add another select ...
0
votes
1answer
16 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
1answer
563 views

Auto save title as custom meta field value

I create a custom post type where I removed the "Title", instead I want to use one of my custom meta value to become the title. This is just to make sure the title look good. Know that the post ...
0
votes
0answers
24 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 ...
1
vote
1answer
268 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 ...
0
votes
1answer
330 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
42 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
573 views

save_post custom post type ? $_POST not working?

i have this code. <?php add_action('add_meta_boxes', 'ct_meta_add'); add_action('save_post','ct_meta_save'); add_action('save_post','ct_parent'); // add meta functions function ct_meta_add() { ...
1
vote
1answer
428 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. ...
3
votes
2answers
2k views

How to avoid infinite loop in save_post callback

I have been using this site alot for solving my problems, but this time I did not succeed in finding and answer for my problem. I get and infinite loop when using wp_update_post inside a function ...
1
vote
1answer
428 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
35 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
22 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
42 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
2answers
59 views

Save checkboxes of a metabox with a foreach loop (invalid argument)

I'm new to Wordpress plugin development and I'm trying to create a list of checkboxes (from a WP Query) to associate as custom fields for a specific post type. Nothing wrong with the display function, ...
0
votes
1answer
20 views

Can't Get Metabox Data Saved Assistance Needed

I'm trying to create meta box on a post create/edit page. I faced the problem: 1. When I create a post from scratch the data from my meta box is saved as expected 2. When I try to update an existing ...
1
vote
1answer
106 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 ...
0
votes
1answer
40 views

Strange bug on post/page save

I have a srtange bug when I try to save/update a post. Every time I got this alert: "Are you sure to live this page?...." I've switched tothe original theme, disabled almost all plugins but nothing ...
0
votes
1answer
51 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
50 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
59 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
68 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 ...
3
votes
2answers
333 views

Disable the post save process completely

I need a way to disable the save process completely using an action/filter. Something that works (for e.g.:) in the query, posts_clauses or wp_insert_post/save_post/update_post hooks. So far I only ...
5
votes
4answers
4k views

Prevent post from being published if custom fields not filled

I have a custom post type Event that contains a starting and ending date/times custom fields (as metaboxes in the post edit screen). I would like to make sure that an Event cannot get published (or ...
0
votes
0answers
42 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: ...
1
vote
1answer
431 views

Remove empty lines (&nbsp;) when author updates their post

Whenever adding an empty line between paragraphs using TinyMCE, the &nbsp; character entity is added. How can I strip the content of all instances of this character whenever an author updates ...
0
votes
1answer
34 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
13 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
174 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
1answer
131 views

Wp_update_post: Infinite loop even with remove_action solution, OOP

I have a quite complex PHP class, reponsible for creating and printing meta_boxes, generating and saving meta fields, ... Each meta_box (object of class) has its own save function, that updates meta ...
0
votes
2answers
110 views

what is correct way to hook when update post

i try to hook when post is updated but all hook i try never executed except updated_post_meta add_action('updated_post_meta', 'my_function'); function my_function($post_id) { echo 'This is ...
2
votes
2answers
142 views

Placement of Code in Plugin for hooking `save_post`

I ran into a strange Problem today developing a new Plugin. I set it up as usual, creating the f711-roomprice folder in the Plugindirectory, and creating the f711-roomprice.php as well as an inc ...
0
votes
0answers
25 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
155 views

Can wp_insert_post_data filter be used to save custom field data?

I have custom field data that I would like to modify on its way to the database. wp_insert_post_data filter seems to be the closest thing I can find to achieving this. I dumped the $data and $postarr ...
0
votes
1answer
128 views

Return code from save_post action?

I'd like to understand what value I should return from a WordPress save_post action function. This example from the save_post documentation both explicitly and implicitly returns without a value: ...
0
votes
1answer
32 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
1answer
16 views

What is the proper way to add a required field to a post type? [duplicate]

So I created a CPT that has a few required fields in a metabox. My metadata is being saved through the save_post hook but from I can find via my googlefu there is no way to stop the saving of the post ...
3
votes
1answer
66 views

Disallow a user to post in certain categories

I am writing a plugin that will disallow user to post in certain categories. I am trying to display an error message to the user when he tries to post in the restricted category and also want WP ...
1
vote
1answer
765 views

update_post_meta() whenever custom post type is updated

I need the following functionality. Whenever my custom post type is updated or saved I need to overwrite certain custom post metas. I need to make sure this only affects posts of the post type ...
0
votes
2answers
432 views

post_status => publish not working

I have a front end form that let users submit a post. This is how i store the data when a post is submitted : if ( isset( $_POST['submitted'] )) { $post_information = array( ...
0
votes
0answers
38 views

How can I check if taxs changed on save_post/post_updated action?

Im running some custom actions on the 'post_updated' action hook. But I need to know if the taxonomies changed on post update to run some extra functions. The action hook only returns $post_after and ...
0
votes
1answer
169 views

Why does not my metabox save?

I know there are many questions about variants of this, but I have not been able to find an answer. I have a metabox on the post type page, containing nothing but a checkbox. It seems like it won't ...
1
vote
1answer
307 views

Updating the database with advanced custom fields

I'm having a real problem with updating a database table using advanced custom fields within a custom post type. I have a table in the database called 'wp_company_profiles' with fields 'address_1' ...
1
vote
0answers
59 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 ...
0
votes
0answers
63 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
218 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
12 views

Post array not printing after post is published? [duplicate]

I'm using this function which displays the post array when I click Add new post. After the post has been published I do not see the array of the published post. What's wrong with the code? I've also ...