How not to show old posts in the archive. WordPress Code exa... open

How not to show old posts in the archive. WordPress Code example

function exclude_old_posts( $query ) {
    if ( ! is_admin() && $query->is_main_query() && is_tax( 'playlist', 90 ) ) {
        $query->set( 'date_query', array(
            array(
                'column' => 'post_date',
                'after' => '1 year ago',
            ),
        ) );
    }
}
add_action( 'pre_get_posts', 'exclude_old_posts' );
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation