0
votes
1answer
21 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 ...
0
votes
1answer
56 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
68 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
2answers
126 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 ...
1
vote
1answer
911 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
136 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
173 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 ...
-1
votes
1answer
85 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: ...
1
vote
3answers
2k views

Custom post type save_post action not firing

Sorry if this is already answered on here. I looked around and couldn't see any answers to my question so I thought I'd post my own. I'm building a plugin for a client that gathers customer feedback ...
2
votes
3answers
2k views

A Post is saved twice or more during add_action(save_post)

I have added a custom meta box for advanced information for a specific post category, to my create new post page. Now I recognize, that if I save the post, it writes 2 entries in the db with 2 ...
1
vote
1answer
734 views

Get the post_id of a new post

There are several ways to get the id of a post after it has been saved (auto, etc.), but is there a way to get the post id immediately after you create a new post? I am trying to create a directory ...
0
votes
1answer
113 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
885 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
238 views

save_post action doesn't passing post id to my function as argument

I'm adding a box to add / update post screen. add_action( 'save_post', 'psd_upload_kaydet' ); add_action( 'add_meta_boxes', 'psd_upload' ); function psd_upload() { add_meta_box("psd-upload", "Bir ...
1
vote
0answers
152 views

Save modified Custom Field content into another Custom Field on article save [closed]

In my articles I allow editors to enter a date in a human readable dd.mm.yyyy format into a custom field. But I also need this date as unix timestamp in the DB. So I wrote a function which takes the ...
14
votes
1answer
4k views

Why does save_post action fire when creating a new post?

I'm surprised by the fact that my function that I've tacked onto the save_post action fires when I click the "New Post" link in the Admin Dashboard. Note - this is before I've pressed Save or Update, ...
3
votes
2answers
644 views

Why can't I hook into save_posts after admin_init?

I'm trying to hook into the "save_post" action from an AJAX callback in my plugin, but it doesn't seem to work. In fact, hooking into "save_posts" only seems to work from a few key action execution ...
7
votes
2answers
2k views

Return $post_id when DOING_AUTOSAVE?

I see the following pattern over and over, on this site and on other places: add_action( 'save_post', 'wpse14169_save_post' ); function wpse14169_save_post( $post_id ) { if ( defined( ...