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
100 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
106 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
654 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
428 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
759 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
381 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
244 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
289 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
27 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
29 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
27 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
23 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
9 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
58 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
21 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
28 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
27 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
0answers
55 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
107 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 ...
0
votes
0answers
54 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
0answers
78 views

Prevent save_post from running when preview button pressed?

I have a bug where my content gets saved twice (2 seperate rows in the posts table). This post creation is for a custom post type so the bug is to do with my code. To reproduce I: Create a new ...
0
votes
1answer
58 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
1answer
169 views

Update Custom Field on Imported Post Creation

So I've created a function that updates several custom fields in a post when the post is created. The idea is to sanitize this information so that I can easily use it for other purposes. The ...
0
votes
2answers
106 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
37 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
79 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
130 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
282 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
93 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
83 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
930 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 ...
0
votes
1answer
94 views

does acf_save_post cause endless loop?

I am using Advanced custom fields acf_save_post hook in one of my functions. In that function I use the add_post_meta function. Does this call acf_save_post again and cause an endless loop? ...
0
votes
1answer
146 views

Metaboxes not saving data

I'm rebuilding a metabox for a plugin and it now won't save the data I enter. The HTML is almost exactly the same as before, but the save_meta function just don't work. I've read through quite a few ...
0
votes
1answer
503 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() { ...
0
votes
1answer
341 views

Using set_post_thumbnail inside save_post action gets overwritten

I've added my own function to save_post as follows: add_action( 'save_post', 'save_recipe' ); function save_recipe( $post_id ) { // ... set $thumb_id from custom code ... ...
0
votes
0answers
176 views

Stop saving process when metabox is invalid [duplicate]

Possible Duplicate: Prevent post from being published if custom fields not filled Check before publishing, if already exist post with current custom field value I am trying to add some ...
0
votes
1answer
528 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
1answer
398 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
68 views

How to extend the page editor?

I'm really a newbie to WordPress. I can edit the page via admin Page menu. There is a form submitted on that page. How can I write my own functions to handle this form submission? In other words, how ...
0
votes
1answer
528 views

Custom Post Custom Taxonomy Data Not Saving in Edit Screen

I have a custom post type "projects" with a custom taxonomy "project_type." If I select a project type taxonomy within the post editor screen and hit update, the taxonomy isn't updated. Worse yet, it ...
0
votes
1answer
550 views

Out of Memory - Line 791 of WP-DB.php (mysql_real_escape_string)

Update The end result is that I did not account for Apache memory limits. There were limits placed on the Apache process which caused PHP to be limited regardless of the settings placed on it. ...
-1
votes
1answer
63 views

What do the numbers mean at the end of add_action('save_post')…?

I've seen on a few tutorials that there are numbers at the end of the call to save Custom Fields/Meta Boxes on the save_post hook. For example, in the WordPress Codex it gives the following example: ...