The save-post tag has no wiki summary.
0
votes
1answer
382 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 ...
3
votes
3answers
942 views
Force post slug to be auto generated from title on save
I'm running a property site where many properties are sold in apartment blocks.
Because of this what the content editors do is create a post/property with all the details and then use a duplicate ...
0
votes
1answer
258 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
63 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 ...
2
votes
1answer
230 views
How to assign default taxonomy to pages on 'save_post'?
I try to assign custom taxonomies to a page when newly added by the "publish" button.
This is the function:
function set_default_object_terms( $id, $post ) {
if ( 'publish' === $post->post_status ...
1
vote
1answer
160 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 ...
0
votes
3answers
804 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 ...
2
votes
1answer
802 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
368 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
622 views
Migrating from metaboxes to wp_editor()
I got a client requirement where the editing facilities available in wordpress had to be available for content that was meant to be displayed on the sidebar of a particular post/page.
The content to ...
0
votes
1answer
95 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
439 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 ...
1
vote
3answers
1k views
Check for update vs new post on save_post action
Is it possible within the save_post action to determine whether it's a new post being created or an existing post being update?
0
votes
1answer
303 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 ...
2
votes
1answer
780 views
Check before publishing, if already exist post with current custom field value
I have a custom post type with only 3 custom fields in it.
$post_types = get_post_meta($post->ID,'post_types',true);
$post_taxonomies = get_post_meta($post->ID,'post_taxonomies',true);
...
1
vote
2answers
2k views
Retrieve 1st image in post and set it as featured image, when post is saved/updated
I need to set a featured image for every post I publish. So, when a post is published/updated, the script would scan the post for the first image using a script like this:
// Get URL of first ...
3
votes
0answers
209 views
Have save_post write to database image meta [closed]
Programming rookie back again.
I have been studying the add_action('save_post','') but I am having difficulty getting it to work for my needs. The concept is simple - update the database information ...
3
votes
4answers
2k 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
1answer
301 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
462 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 ...
2
votes
1answer
422 views
Why is my custom meta box input not saving
I've added the following function to functions.php to add a custom meta box enabling the end user to input a gallery shortcode. I then intend to use this to place a gallery in a specific place on the ...
1
vote
1answer
64 views
Publish/Update post is changing image links from file url to post url
I've written a filter to wrap images included in posts with figure tags and their captions with figcaption tags. I turned off the visual editor so that it doesn't strip out all the html from the ...
0
votes
1answer
169 views
WordPress as a web app - always auto-save post and meta data
Is is possible to make WordPress auto-save revisiona more often and have the auto-save version always be the most recent version - Like the way google docs works. This would mean the update button is ...
0
votes
1answer
189 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
3answers
261 views
Is it possible to create a post using a metabox?
I am trying to create a post (well, in the end, multiple posts) from a metabox using the 'save_post' hook. I executed the script once, creating 3900 or so new posts before I crawled into posts.php and ...
1
vote
0answers
134 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 ...
1
vote
1answer
309 views
How can I set taxonomy programmatically
Here is my situation. I plan to distribute a theme I am working on and it has a custom post type called Code and it has a custom taxonomy called Languages now I also use a custom metabox with a ...
1
vote
1answer
719 views
save_post + insert_post = infinite loop
I'm trying to automatically create a new post when a post containing a certain custom field is saved - hooking an insert_post function into save_post.
This generates an infinite loop.
I found some ...
0
votes
1answer
232 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 ...
4
votes
2answers
1k views
Why won't my metabox data save?
I have a custom post with a lot of meta boxes. I recently tried to add some dynamic metaboxes, using this question: Create more Meta Boxes as needed
I managed to get the metaboxes to add nicely, the ...
0
votes
2answers
542 views
Remove image from post_content on save_post
I'm trying to setup a function in functions.php that removes an image from the post_content on save. Everything works up until the time I'm trying to save the content, the page just hangs and I get a ...
2
votes
1answer
600 views
Post Auto Draft Issue
I've made custom post type without title and editor and I use custom taxonomies, custom fields and attachments to form a post. My title is generated from custom taxonomies and custom fields (or "ID #" ...
9
votes
1answer
2k 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, ...
0
votes
1answer
179 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
1answer
457 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. ...
2
votes
1answer
390 views
Post Formats in the context of the Database 'Save Post' function
I am trying to pick up an in-depth understanding of how post-formats relate to posts 'in the database' - i.e. what meta information when compiled together constitutes a post format. And yes, I do ...
0
votes
3answers
974 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 ...
2
votes
2answers
2k views
Set custom messages for post update/save
I am trying to make a custom message instead of the default message when i save a post, does anybody know how to do it!
0
votes
1answer
236 views
Custom field values get deleted
I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and ...
2
votes
2answers
544 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 ...
1
vote
3answers
2k views
Conflicting save_post functions when passing the post id and saving custom meta boxes for different post types
Post save functions are conflicting with each other when adding them to the save_post action hook.
2 different custom post types with 2 different (one for each post type) custom meta boxes.
I'm ...
8
votes
3answers
3k views
Passing error/warning messages from a meta box to “admin_notices”
I have a simple meta box that updates the post custom fields (using update_post_meta()).
How can I send a error or warning message to the next page after the user publishes/updates the post and ...
6
votes
2answers
1k 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( ...
1
vote
1answer
282 views
Trigger “unsaved changes” dialog for custom post meta changes
I'm using a custom post type with custom meta fields, but autosave and the "unsaved changes" dialog don't seem to be triggered for these custom meta fields. Autosave isn't as important to me as the ...
1
vote
2answers
523 views
Metabox saves on Update or Publish, but not on Saving Draft
I have created custom post types that also have custom meta_boxes I've created. Currently, they save when I publish or update a post, but they don't save when I'm in draft mode making changes.
...
0
votes
1answer
260 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, ...
2
votes
2answers
497 views
Submitting posts from the front end - sanitizing data
I have a form that allows any registered user to submit a post (it's a custom post type - forum related), and I'm using wp_insert_post() to insert it into the db.
From what I've seen in this function ...
1
vote
1answer
167 views
save_post requiere at least one uploaded file to be published
Is there a way to check the Published status of a post, and if it doesnt has at least one image or file uploaded, then change status of published to draft?
Thanks in advance.
15
votes
6answers
5k views
Add validation and error handling when saving custom fields?
I have a function that defines a custom field on a post type. Say the field is "subhead".
When the post is saved, I want to do some validation on the input, and display an error message on the post ...
1
vote
2answers
1k views
How can I pass $post object to 'save_post' add_action?
I have several functions that are called from inside a save_post function. However, all of the functions that use the $post object are returning incorrect values because it appears that the default ...