} elseif ( in_array( $post_obj->post_name, $post, true ) ) {
return true;
} else {
foreach ( $post as $postpath ) {
if ( ! strpos( $postpath, '/' ) ) {
continue;
}
$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );
if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {
return true;
}
}
}
return false;
}
/**
* Determines whether the query is for an existing single post of any post type
* (post, attachment, page, custom post types).
*
* If the $post_types parameter is specified, this function will additionally
* check if the query is for one of the Posts Types specified.
*
* @since 3.1.0
*
* @see WP_Query::is_page()
* @see WP_Query::is_single()
*
* @param string|string[] $post_types Optional. Post type or array of post types
* to check against. Default empty.
* @return bool Whether the query is for an existing single post
* or any of the given post types.
*/
public function is_singular( $post_types = '' ) {
if ( empty( $post_types ) || ! $this->is_singular ) {
return (bool) $this->is_singular;
}
$post_obj = $this->get_queried_object();
if ( ! $post_obj ) {
return false;
}
return in_array( $post_obj->post_type, (array) $post_types, true );
}
/**
* Determines whether the query is for a specific time.
*
* @since 3.1.0
*
* @return bool Whether the query is for a specific time.
*/
public function is_time() {
return (bool) $this->is_time;
}
/**
* Determines whether the query is for a trackback endpoint call.
*
* @since 3.1.0
*
* @return bool Whether the query is for a trackback endpoint call.
*/
public function is_trackback() {
return (bool) $this->is_trackback;
}
/**
* Determines whether the query is for an existing year archive.
*
* @since 3.1.0
*
* @return bool Whether the query is for an existing year archive.
*/
public function is_year() {
return (bool) $this->is_year;
}
/**
* Determines whether the query is a 404 (returns no results).
*
* @since 3.1.0
*
* @return bool Whether the query is a 404 error.
*/
public function is_404() {
return (bool) $this->is_404;
}
/**
* Determines whether the query is for an embedded post.
*
* @since 4.4.0
*
* @return bool Whether the query is for an embedded post.
*/
public function is_embed() {
return (bool) $this->is_embed;
}
/**
* Determines whether the query is the main query.
*
* @since 3.3.0
*
* @global WP_Query $wp_the_query WordPress Query object.
*
* @return bool Whether the query is the main query.
*/
public function is_main_query() {
global $wp_the_query;
return $wp_the_query === $this;
}
/**
* Sets up global post data.
*
* @since 4.1.0
* @since 4.4.0 Added the ability to pass a post ID to `$post`.
*
* @global int $id
* @global WP_User $authordata
* @global string $currentday
* @global string $currentmonth
* @global int $page
* @global array $pages
* @global int $multipage
* @global int $more
* @global int $numpages
*
* @param WP_Post|object|int $post WP_Post instance or Post ID/object.
* @return true True when finished.
*/
public function setup_postdata( $post ) {
global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
if ( ! ( $post instanceof WP_Post ) ) {
$post = get_post( $post );
}
if ( ! $post ) {
return;
}
$elements = $this->generate_postdata( $post );
if ( false === $elements ) {
return;
}
$id = $elements['id'];
$authordata = $elements['authordata'];
$currentday = $elements['currentday'];
$currentmonth = $elements['currentmonth'];
$page = $elements['page'];
$pages = $elements['pages'];
$multipage = $elements['multipage'];
$more = $elements['more'];
$numpages = $elements['numpages'];
/**
* Fires once the post data has been set up.
*
* @since 2.8.0
* @since 4.1.0 Introduced `$query` parameter.
*
* @param WP_Post $post The Post object (passed by reference).
* @param WP_Query $query The current Query object (passed by reference).
*/
do_action_ref_array( 'the_post', array( &$post, &$this ) );
return true;
}
/**
* Generates post data.
*
* @since 5.2.0
*
* @param WP_Post|object|int $post WP_Post instance or Post ID/object.
* @return array|false Elements of post or false on failure.
*/
public function generate_postdata( $post ) {
if ( ! ( $post instanceof WP_Post ) ) {
$post = get_post( $post );
}
if ( ! $post ) {
return false;
}
$id = (int) $post->ID;
$authordata = get_userdata( $post->post_author );
$currentday = false;
$currentmonth = false;
$post_date = $post->post_date;
if ( ! empty( $post_date ) && '0000-00-00 00:00:00' !== $post_date ) {
// Avoid using mysql2date for performance reasons.
$currentmonth = substr( $post_date, 5, 2 );
$day = substr( $post_date, 8, 2 );
$year = substr( $post_date, 2, 2 );
$currentday = sprintf( '%s.%s.%s', $day, $currentmonth, $year );
}
$numpages = 1;
$multipage = 0;
$page = $this->get( 'page' );
if ( ! $page ) {
$page = 1;
}
/*
* Force full post content when viewing the permalink for the $post,
* or when on an RSS feed. Otherwise respect the 'more' tag.
*/
if ( get_queried_object_id() === $post->ID && ( $this->is_page() || $this->is_single() ) ) {
$more = 1;
} elseif ( $this->is_feed() ) {
$more = 1;
} else {
$more = 0;
}
$content = $post->post_content;
if ( str_contains( $content, '' ) ) {
$content = str_replace( "\n\n", '', $content );
$content = str_replace( "\n", '', $content );
$content = str_replace( "\n", '', $content );
// Remove the nextpage block delimiters, to avoid invalid block structures in the split content.
$content = str_replace( '', '', $content );
$content = str_replace( '', '', $content );
// Ignore nextpage at the beginning of the content.
if ( str_starts_with( $content, '' ) ) {
$content = substr( $content, 15 );
}
$pages = explode( '', $content );
} else {
$pages = array( $post->post_content );
}
/**
* Filters the "pages" derived from splitting the post content.
*
* "Pages" are determined by splitting the post content based on the presence
* of `` tags.
*
* @since 4.4.0
*
* @param string[] $pages Array of "pages" from the post content split by `` tags.
* @param WP_Post $post Current post object.
*/
$pages = apply_filters( 'content_pagination', $pages, $post );
$numpages = count( $pages );
if ( $numpages > 1 ) {
if ( $page > 1 ) {
$more = 1;
}
$multipage = 1;
} else {
$multipage = 0;
}
$elements = compact( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );
return $elements;
}
/**
* Generates cache key.
*
* @since 6.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $args Query arguments.
* @param string $sql SQL statement.
* @return string Cache key.
*/
protected function generate_cache_key( array $args, $sql ) {
global $wpdb;
unset(
$args['cache_results'],
$args['fields'],
$args['lazy_load_term_meta'],
$args['update_post_meta_cache'],
$args['update_post_term_cache'],
$args['update_menu_item_cache'],
$args['suppress_filters']
);
if ( empty( $args['post_type'] ) ) {
if ( $this->is_attachment ) {
$args['post_type'] = 'attachment';
} elseif ( $this->is_page ) {
$args['post_type'] = 'page';
} else {
$args['post_type'] = 'post';
}
} elseif ( 'any' === $args['post_type'] ) {
$args['post_type'] = array_values( get_post_types( array( 'exclude_from_search' => false ) ) );
}
$args['post_type'] = (array) $args['post_type'];
// Sort post types to ensure same cache key generation.
sort( $args['post_type'] );
if ( isset( $args['post_status'] ) ) {
$args['post_status'] = (array) $args['post_status'];
// Sort post status to ensure same cache key generation.
sort( $args['post_status'] );
}
// Add a default orderby value of date to ensure same cache key generation.
if ( ! isset( $q['orderby'] ) ) {
$args['orderby'] = 'date';
}
$placeholder = $wpdb->placeholder_escape();
array_walk_recursive(
$args,
/*
* Replace wpdb placeholders with the string used in the database
* query to avoid unreachable cache keys. This is necessary because
* the placeholder is randomly generated in each request.
*
* $value is passed by reference to allow it to be modified.
* array_walk_recursive() does not return an array.
*/
static function ( &$value ) use ( $wpdb, $placeholder ) {
if ( is_string( $value ) && str_contains( $value, $placeholder ) ) {
$value = $wpdb->remove_placeholder_escape( $value );
}
}
);
ksort( $args );
// Replace wpdb placeholder in the SQL statement used by the cache key.
$sql = $wpdb->remove_placeholder_escape( $sql );
$key = md5( serialize( $args ) . $sql );
$last_changed = wp_cache_get_last_changed( 'posts' );
if ( ! empty( $this->tax_query->queries ) ) {
$last_changed .= wp_cache_get_last_changed( 'terms' );
}
return "wp_query:$key:$last_changed";
}
/**
* After looping through a nested query, this function
* restores the $post global to the current post in this query.
*
* @since 3.7.0
*
* @global WP_Post $post Global post object.
*/
public function reset_postdata() {
if ( ! empty( $this->post ) ) {
$GLOBALS['post'] = $this->post;
$this->setup_postdata( $this->post );
}
}
/**
* Lazyloads term meta for posts in the loop.
*
* @since 4.4.0
* @deprecated 4.5.0 See wp_queue_posts_for_term_meta_lazyload().
*
* @param mixed $check
* @param int $term_id
* @return mixed
*/
public function lazyload_term_meta( $check, $term_id ) {
_deprecated_function( __METHOD__, '4.5.0' );
return $check;
}
/**
* Lazyloads comment meta for comments in the loop.
*
* @since 4.4.0
* @deprecated 4.5.0 See wp_lazyload_comment_meta().
*
* @param mixed $check
* @param int $comment_id
* @return mixed
*/
public function lazyload_comment_meta( $check, $comment_id ) {
_deprecated_function( __METHOD__, '4.5.0' );
return $check;
}
}
Fatal error: Uncaught Error: Class 'WP_Query' not found in /home/kordian1/domains/ostrabrama.pl/public_html/wp-settings.php:577
Stack trace:
#0 /home/kordian1/domains/ostrabrama.pl/public_html/wp-config.php(81): require_once()
#1 /home/kordian1/domains/ostrabrama.pl/public_html/wp-load.php(50): require_once('/home/kordian1/...')
#2 /home/kordian1/domains/ostrabrama.pl/public_html/wp-blog-header.php(13): require_once('/home/kordian1/...')
#3 /home/kordian1/domains/ostrabrama.pl/public_html/index.php(17): require('/home/kordian1/...')
#4 {main}
thrown in /home/kordian1/domains/ostrabrama.pl/public_html/wp-settings.php on line 577