get_lastpostmodified example

|| str_contains( $this->query_vars['feed'], 'comments-' )
                || ( empty( $this->query_vars['withoutcomments'] )
                    && ( ! empty( $this->query_vars['p'] )
                        || ! empty( $this->query_vars['name'] )
                        || ! empty( $this->query_vars['page_id'] )
                        || ! empty( $this->query_vars['pagename'] )
                        || ! empty( $this->query_vars['attachment'] )
                        || ! empty( $this->query_vars['attachment_id'] )
                    )
                )
            ) {
                $wp_last_modified_post    = mysql2date( $date_formatget_lastpostmodified( 'GMT' ), false );
                $wp_last_modified_comment = mysql2date( $date_formatget_lastcommentmodified( 'GMT' ), false );
                if ( strtotime( $wp_last_modified_post ) > strtotime( $wp_last_modified_comment ) ) {
                    $wp_last_modified = $wp_last_modified_post;
                } else {
                    $wp_last_modified = $wp_last_modified_comment;
                }
            } else {
                $wp_last_modified = mysql2date( $date_formatget_lastpostmodified( 'GMT' ), false );
            }

            if ( ! $wp_last_modified ) {
                
// Add the comment times to the post times for comparison.             $modified_times = array_merge( $modified_times$comment_times );
        }

        // Determine the maximum modified time.         $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', max( $modified_times )$utc );
    }

    if ( false === $datetime ) {
        // Fall back to last time any post was modified or published.         $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', get_lastpostmodified( 'GMT' )$utc );
    }

    if ( false !== $datetime ) {
        $max_modified_time = $datetime->format( $format );
    }

    /** * Filters the date the last post or comment in the query was modified. * * @since 5.2.0 * * @param string|false $max_modified_time Date the last post or comment was modified in the query, in UTC. * False on failure. * @param string $format The date format requested in get_feed_build_date(). */
Home | Imprint | This part of the site doesn't use cookies.