Auto draft post

Posted: September 19, 2015 in Uncategorized
Tags: ,

After admin login, when we go to wp-admin/post-new.php (for add new post) At that time one row in database is created.
and the entry was include new post id and post status is auto-draft.
And when we again refresh the page, none more row is created with new post id and post status


check out this plugin : LINK

by using this plugin,Resize image with no crop .

after creating taxonomy-tax_slug.php page , I want to add parent taxonomy name when sub taxonomy is being viewing


$term = $wp_query->queried_object;
$parent_id =  $term->parent;
$parent_tax_arr = get_term_by(‘id’, $parent_id, ‘tax_slug’);
echo $parent_tax_arr->name.’->’;
printf( __( ‘%s’, ‘your_textdomain’ ), single_cat_title( ”, false ) );


add_action( ‘admin_init’, ‘my_admin_init’ );
function my_admin_init() {
add_filter( ‘manage_edit-leave_columns’, ‘my_new_custom_post_column’);
add_action( ‘manage_leave_posts_custom_column’, ‘location_tax_column_info’, 10, 2);

function my_new_custom_post_column( $column ) {
$column[‘leave_type’] = ‘Leave Type’;

return $column;

function location_tax_column_info( $column_name, $post_id ) {

//$post_type = get_post_type($post_id);
$terms = get_the_terms($post_id, ‘leave_type’);

if (!empty($terms) ) {
foreach ( $terms as $term )
echo $term->name;
else echo ‘<i>No Location Set. </i>’;

Hi all,

recently I just try to add class in li tag in wp nav menu.After some search I got this:

Filter Name : nav_menu_css_class


function li_class($classes, $item, $args) {
$classes[] = ‘YOUR_CLASS_NAME’;  // add our class name
return $classes;


following code will run at every 15 minutes.

if you want to use while loop inside cron function,you need to check every function inside wp_query.some times global $post variable not worked 😦

add_filter(‘cron_schedules’, ‘add_scheduled_interval’);

// add once 5 minute interval to wp schedules
function add_scheduled_interval($schedules) {
$schedules[‘minutes_my’] = array(‘interval’=>300, ‘display’=>’Once 5 minutes’);
return $schedules;
if (!wp_next_scheduled(‘minutes_my_cron’)) {
wp_schedule_event(time(), ‘minutes_my’, ‘minutes_my_cron’);
add_action(‘minutes_my_cron’, ‘min_cron_executor’);

function min_cron_executor() {

//add CODE