Skip to main content
deleted 11 characters in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );
    '

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'before' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );
    '

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'before' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'before' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)

added 1 character in body
Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );
    '

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'after''before' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );
    '

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'after' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );
    '

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'before' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)

Source Link
birgire
  • 67.8k
  • 7
  • 119
  • 251

You can use the posts_where filter:

// Add custom filter
add_filter( 'posts_where', 'wpse_modified' );

// Fetch posts
$query = new WP_Query( $lastupdated_args );
    '

where you can define the filter callback as:

function wpse_modified( $where )
{
   global $wpdb;
   // Run only once:
   remove_filter( current_filter(), __FUNCTION__ );
   // Append custom SQL
   return $where . " AND {$wpdb->posts}.post_modified} != {$wpdb->posts}.post_modified} ';
}

Though it would be handy to be able to use this kind of date queries:

$args = [
    'date_query' => [
        [ 'after' => 'post_modified' ]
    ],
];

and

$args = [
    'date_query' => [
        [ 
            'column'    => 'post_modified_gmt', 
            'after'     => 'post_date_gmt', 
            'inclusive' => false 
        ]
    ],
];

That's maybe an idea for a core ticket! ;-)