• Resolved ZaGenie

    (@zagenie)


    Hello,

    Do you perhaps have the SQL command handy, to mass update listings to Never Expires.

    Yes, there is the option in settings to set to never expire, but we have bunch of listings that were entered, before that setting was set correctly.

    Greatly appreciated if such a SQL command can be published here.

    Herby

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author pluginsware

    (@pluginsware)

    Hi,

    Please addd teh below code in your theme’s function.php and refresh your site to make all your listings to Never Expire.

    function acadp_set_never_expire() {
        $args = array(  
    		'post_type' => 'acadp_listings',
    		'post_status' => 'publish',
    		'posts_per_page' => -1,
    		'fields' => 'ids',
    		'meta_query' => array( array(
    		'key' => 'never_expires',
    		'compare' => 'NOT EXISTS',
    	)
    	)
    );
    
    $loop = new WP_Query( $args );
    if ( $loop->have_posts() ) {
        foreach ( $loop->posts as $post_id ) {
            update_post_meta( $post_id, 'never_expires', 1 );
        }
    }
    }
    add_action( 'init', 'acadp_set_never_expire' );

    Please remove the code after the job is done.

    Thanks

    Thread Starter ZaGenie

    (@zagenie)

    Thanks!

    Excellent support.

    Herby

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SQL command to mass update listing to Never Expires.’ is closed to new replies.