Preview Post/Custom Post types in Archive

The get_posts method of WP_Query is what does the heavy lifting as far as getting the posts to display. Before it does anything, however, there’s a hook called pre_get_posts that you can hook into. The hooked function will receive a reference (pointer) to the current query object. So you can change the query vars to … Read more

Can I set a timer for pages to be published?

No script of function necessary. It’s actually built into WordPress. Simply go to your page to edit and on the right hand side you should see a widget labeled Publish. On the third line down, you will see an Edit button and you can set the date and time on when you want the page … Read more

Post Auto Draft Issue

You probably need to modify the columns displayed in your Custom Post posts list, so that the list isn’t dependent solely on Post Title. I have a similar situation, with a Custom Post Type that consists solely of a “featured image” (and a “link” custom metabox). I modified the Post list to output the image, … Read more

Don’t post or draft if post already exists

I have no idea what IFTTT is but you can use the save_post action hook to do a check for duplicate posts. This hook runs whenever a post is created or updated you would then be able to right your own code to check against existing posts. http://codex.wordpress.org/Plugin_API/Action_Reference/save_post

Create front end link to save post (or unpublish post) as draft

You can use wp_update_post() to change the status of a post. global $current_user; get_currentuserinfo(); $post_id = $_GET[‘post_id’]; $the_post = get_post( $post_id ); if ( $the_post->post_author == $current_user->ID && $the_post ) { $the_post->post_status=”draft”; wp_update_post( $the_post ); } Use wp_insert_post() with post_status => ‘draft’ to save a post.

Does WordPress remove draft status automatically?

Just by itself WordPress will not change the post status. However, if you have a plugin like Draft Scheduler installed, drafts will be published automatically, possibly with some interval. So, you should check your plugins on this type of activity. Another possibility would be that a backup of the database has been installed after a … Read more

Create slugs programmatically

You need to programmatically set the slug as you do so. An SQL trigger could do the trick. Don’t forget to mind duplicate slugs as you write it. Else, instead of publishing using the database, write a php script that calls the WP API.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)