The save-post tag has no wiki summary.
0
votes
1answer
19 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
1answer
42 views
Custom wp_editor doesn't update post_content
I'm working on a client's site, creating a staff profile plugin. The issue is that they previously created the profiles as regular posts. I converted all of the staff posts into a custom post types.
...
0
votes
2answers
26 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
30 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
13 views
where does this $post_id come from?
I was trying to figure out why save_post wasn't being fired upon 'Quick edit', and found the solution here - apparently global $post is not available when updating a post in Quick edit mode.
So - I ...
1
vote
2answers
46 views
How to run a function once on every post in database?
I have a simple function that automatically formats the whole post after publishing/updating.
It's hooked on:
add_action('save_post', 'myFunction');
I would like to format every post, that I ...
0
votes
2answers
30 views
Save custom value to main content of post
I create a meta custom input to make a page builder. So i can drop & drag element to build content for post.
And when i save post, i want it will save directly to post content.
So i think i will ...
0
votes
1answer
100 views
Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
I have been beating my brains on this one for days now and my Google-fu is failing me.
I have created a custom meta box with a dropdown menu that lists all of the terms from a custom taxonomy. What I ...
2
votes
1answer
64 views
Frontend posting - everything saves other than checkboxes?
I have a form on the frontend of Wordpress which is saving all fields except a checkbox array. It displays and saves the correct values if I tick the boxes in the backend post editor, and the ticks ...
2
votes
1answer
66 views
unable to save post meta on single field with multiple selects
I set up two select boxes in one meta field by putting two arrays inside the 'options' array of my callback. The HTML is outputting fine, but the meta is not being saved to the database...
Here is a ...
0
votes
1answer
27 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
1answer
39 views
displaying an error before update_post_meta
I'm trying to restrict how many items you can associate with a post so in my save function I have:
add_action( 'save_post', array( $this, 'save_custom_items_data' ), 10, 2 );
public function ...
0
votes
1answer
63 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, ...
1
vote
1answer
56 views
Action hook 'save_post' triggered when deleting posts
I developed a custom plugin which rewrite some content of my posts, but when i move a post to trash, the action hook 'save_post' is triggered and the post is not deleted.
A simplified version of my ...
0
votes
1answer
46 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 = ...
1
vote
1answer
83 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
2answers
31 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
30 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:
...
0
votes
0answers
16 views
Custom post type sometimes duplicates on save
My plugin uses a custom post type where you can type text in a text field and with javascript add another text field dynamically, think of a todo list where you can keep adding new items.
When they ...
0
votes
1answer
66 views
Minimum Word Count Before A Post Can Be Made Pending Review
I'm looking for a way to check that a post has a minimum word count before allowing it to be sent for review (added to the pending post status).
Below is the code I have:
if ...
0
votes
0answers
40 views
Trying to understand the action: save_post and an incomplete $post object
I begin with a fresh post (i.e., add New). I fetch (via Ajax) an image (read: src) from another site. In the process of saving (action: save_post) I want to PHP copy() the image to my local server and ...
0
votes
0answers
38 views
Strange / unexpected results with add_action('save_post')
As I'm sure plenty of you know already, 'save_post' will actually fire multiple times for a given save. Rather than copy / paste the same 12+ lines of code every time I need just a single fire, I ...
2
votes
0answers
68 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
1answer
166 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 ...
1
vote
1answer
103 views
Better post meta efficiency?
I work with websites which require using Post Meta for Post Objects within a particular Post Type.
I often add a Meta Box to a particular Post Type, to provide additional settings for the new Post ...
1
vote
1answer
285 views
How can i create a function to get youtube video time
Tom J Nowell posted this code to help me retrieve the YouTube video time.
Functions
// function to parse the code from the URL
function parse_youtube_video_id_from_url( $video_url ) {
...
0
votes
1answer
45 views
Why does publish_{custom-post-type} fire on update?
I'm trying to fire two different actions on both publish and update. Neither should ever fire at the same time.
The problem is that publish_pm_task is getting fired on update and save_post is never ...
0
votes
1answer
55 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 ...
2
votes
2answers
74 views
How to check what kind of saving it is?
I use save_post hook, and I have to know inside this hook function, whether it is a publishing ( draft to publish ) or is it an updating, like publish to publish or draft to draft.
Is there a way to ...
0
votes
1answer
48 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
386 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
2answers
239 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 ...
1
vote
3answers
322 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 ...
0
votes
1answer
46 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
0answers
158 views
How to trigger bulk update action? [closed]
I have more than a hunderd posts from custom post type and I have to add custom fields to each post, I've used 'save_post' to trigger update/publish event, but for me it works only when "Publish" ...
1
vote
2answers
71 views
get_terms on save_post hook
Usually, if I want to check for some attribute of the post I'm about to publish, I will check like this:
$post_title = $_POST['post_title'];
post_title is the name of the title field in the edit ...
1
vote
2answers
234 views
Using save_post to replace the post's title
I am using custom posts, and in these, I don't a need for the title.
This causes Wordpress to set the titles of my posts to "Auto Draft".
I'd like to change the title's value to something else, ...
4
votes
1answer
149 views
Saving (Updating) Post / Page Edits With AJAX
One of the major frustrations while editing posts/pages is that after saving, two things happen:
The admin page is reloaded, which takes time
More importantly, the cursor position is lost
If ...
0
votes
1answer
70 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
234 views
Compare custom taxonomies of updated post (or new post) [Updated with progress]
I am using the Transients API to cache category loops for a custom taxonomy. All works fine, but if I add a new post or update an existing one, I woud like to compare the taxonomy values and then ...
0
votes
1answer
106 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
296 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
124 views
using new WP_Query in save_post function alters $post
I'm trying to include a WP_Query in a save_post function for a custom post type. The query is used to check all the other posts for a custom field bh_shortcode to make sure the content of the field is ...
0
votes
1answer
277 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
3answers
166 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
329 views
Is there an easy way to AJAX-ify saving of post?
We have a plugin that allows us to manage custom post types and we'd like to add AJAX functionality in saving, editing, and deleting posts. I couldn't find similar problems in the internet so I'm ...
0
votes
1answer
169 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
0answers
144 views
get_term_meta not working on save_post [closed]
I'm doing a custom post type 'budget' to taxonomy 'budget-term' relationship using post meta 'budget-term-id'. This hooks starts on save_post, and basically it creates a 'budget-term' term and save ...
1
vote
1answer
149 views
Faking the “onSave” event
While a specific use-case, I believe this may benefit others.
I am using TurboCSV to mass-import a number of posts into WordPress (which it is doing wonderfully so far). Within that import, I am ...
1
vote
0answers
72 views
Events: Check for other event with same start date and category
I am using The Events Calendar and (correct me if I'm wrong) there is no checking to see if an event has a time conflict with another event that's already been entered. For example, if there is ...

