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( ‘post_title’ => wp_strip_all_tags( $_POST[‘postTitle’] ), ‘post_content’ => $_POST[‘postContent’], ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’ ); $new_post = wp_insert_post( $post_information ); The … Read more

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 clears all taxonomy values associated with that project. Oddly, I added a column in the admin screen to display the custom … Read more

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 directory in there. Everything worked fine with the activation hook and the included functions, until i created an include: include(‘inc/filter-savepost.php’); this file … Read more

How to manage saving custom field from Quick edit and Post Save using save_post action hook without colliding each other?

I’s following Rachel Carden’s tutorial on creating Quick Edit and Bulk Edit, and grabbed her full work from her github repo. I managed doing everything fine and I made a checkbox instead of radio buttons for one of my field called “Featured” (meta_key: pre_featured). I made some changes to the concept though? As I’s using … Read more

publish_post conflicts with save_post

my plugin has a save_post hook used to save the custom fields. now I add a publish_slider hook used to change a checkbox’s status(slider is a custom post type). but it doesn’t work properly. the save_post hook is as below add_action(‘save_post’, ‘save_post_func’, 10, 1); function save_post_func($post_id) { if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE ) return; if … Read more

Cron While Editing Post

I have a multi-author blog, on which there are two schedule cron functions. The first function moves all public posts in the pending status after 365 days: if( ! wp_next_scheduled( ‘expire_posts_hook_publish’ ) ) { wp_schedule_event( time(), ‘hourly’, ‘expire_posts_hook_publish’ ); } add_action( ‘expire_posts_hook_publish’, ‘expire_posts_publish’ ); function expire_posts_publish() { global $wpdb; $daystogo = “365”; $sql = “UPDATE … Read more

Get Post ID with insert/edit link

Hi I want to get the post ID from the post selected in the insert/edit link button. I would normally do: <a data-id=”<?php echo $post->ID; ?>” href=”https://wordpress.stackexchange.com/questions/256062/<?php the_permalink();?>”> Sample page link </a> But whenever the user adds the links from the tinymce content editor all they get is the permalink, I don’t know how to … Read more

Support auto-save and revisions for custom fields

I recently read this tutorial about custom fields in WordPress and wrote a simple plug-in to provide a metabox with a set of input fields. I do not use the Meta Box plug-in promoted on the web site. My implementation for the save_post hook is as follows: function save_my_data( $post_id ) { if ( defined( … Read more