Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: class-wp-query.php
if ( $this->is_home && $page <= 1 && is_array( $sticky_posts ) && ! empty( $sticky_posts ) && ! $q['ignore_sticky_posts'] ) {
[3500] Fix | Delete
$num_posts = count( $this->posts );
[3501] Fix | Delete
$sticky_offset = 0;
[3502] Fix | Delete
// Loop over posts and relocate stickies to the front.
[3503] Fix | Delete
for ( $i = 0; $i < $num_posts; $i++ ) {
[3504] Fix | Delete
if ( in_array( $this->posts[ $i ]->ID, $sticky_posts, true ) ) {
[3505] Fix | Delete
$sticky_post = $this->posts[ $i ];
[3506] Fix | Delete
// Remove sticky from current position.
[3507] Fix | Delete
array_splice( $this->posts, $i, 1 );
[3508] Fix | Delete
// Move to front, after other stickies.
[3509] Fix | Delete
array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );
[3510] Fix | Delete
// Increment the sticky offset. The next sticky will be placed at this offset.
[3511] Fix | Delete
++$sticky_offset;
[3512] Fix | Delete
// Remove post from sticky posts array.
[3513] Fix | Delete
$offset = array_search( $sticky_post->ID, $sticky_posts, true );
[3514] Fix | Delete
unset( $sticky_posts[ $offset ] );
[3515] Fix | Delete
}
[3516] Fix | Delete
}
[3517] Fix | Delete
[3518] Fix | Delete
// If any posts have been excluded specifically, Ignore those that are sticky.
[3519] Fix | Delete
if ( ! empty( $sticky_posts ) && ! empty( $q['post__not_in'] ) ) {
[3520] Fix | Delete
$sticky_posts = array_diff( $sticky_posts, $q['post__not_in'] );
[3521] Fix | Delete
}
[3522] Fix | Delete
[3523] Fix | Delete
// Fetch sticky posts that weren't in the query results.
[3524] Fix | Delete
if ( ! empty( $sticky_posts ) ) {
[3525] Fix | Delete
$stickies = get_posts(
[3526] Fix | Delete
array(
[3527] Fix | Delete
'post__in' => $sticky_posts,
[3528] Fix | Delete
'post_type' => $post_type,
[3529] Fix | Delete
'post_status' => 'publish',
[3530] Fix | Delete
'posts_per_page' => count( $sticky_posts ),
[3531] Fix | Delete
'suppress_filters' => $q['suppress_filters'],
[3532] Fix | Delete
'cache_results' => $q['cache_results'],
[3533] Fix | Delete
'update_post_meta_cache' => $q['update_post_meta_cache'],
[3534] Fix | Delete
'update_post_term_cache' => $q['update_post_term_cache'],
[3535] Fix | Delete
'lazy_load_term_meta' => $q['lazy_load_term_meta'],
[3536] Fix | Delete
)
[3537] Fix | Delete
);
[3538] Fix | Delete
[3539] Fix | Delete
foreach ( $stickies as $sticky_post ) {
[3540] Fix | Delete
array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );
[3541] Fix | Delete
++$sticky_offset;
[3542] Fix | Delete
}
[3543] Fix | Delete
}
[3544] Fix | Delete
}
[3545] Fix | Delete
[3546] Fix | Delete
if ( ! $q['suppress_filters'] ) {
[3547] Fix | Delete
/**
[3548] Fix | Delete
* Filters the array of retrieved posts after they've been fetched and
[3549] Fix | Delete
* internally processed.
[3550] Fix | Delete
*
[3551] Fix | Delete
* @since 1.5.0
[3552] Fix | Delete
*
[3553] Fix | Delete
* @param WP_Post[] $posts Array of post objects.
[3554] Fix | Delete
* @param WP_Query $query The WP_Query instance (passed by reference).
[3555] Fix | Delete
*/
[3556] Fix | Delete
$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );
[3557] Fix | Delete
}
[3558] Fix | Delete
[3559] Fix | Delete
/*
[3560] Fix | Delete
* Ensure that any posts added/modified via one of the filters above are
[3561] Fix | Delete
* of the type WP_Post and are filtered.
[3562] Fix | Delete
*/
[3563] Fix | Delete
if ( $this->posts ) {
[3564] Fix | Delete
$this->post_count = count( $this->posts );
[3565] Fix | Delete
[3566] Fix | Delete
/** @var WP_Post[] */
[3567] Fix | Delete
$this->posts = array_map( 'get_post', $this->posts );
[3568] Fix | Delete
[3569] Fix | Delete
if ( $q['cache_results'] ) {
[3570] Fix | Delete
if ( $is_unfiltered_query && $unfiltered_posts === $this->posts ) {
[3571] Fix | Delete
update_post_caches( $this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
[3572] Fix | Delete
} else {
[3573] Fix | Delete
$post_ids = wp_list_pluck( $this->posts, 'ID' );
[3574] Fix | Delete
_prime_post_caches( $post_ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
[3575] Fix | Delete
}
[3576] Fix | Delete
}
[3577] Fix | Delete
[3578] Fix | Delete
/** @var WP_Post */
[3579] Fix | Delete
$this->post = reset( $this->posts );
[3580] Fix | Delete
} else {
[3581] Fix | Delete
$this->post_count = 0;
[3582] Fix | Delete
$this->posts = array();
[3583] Fix | Delete
}
[3584] Fix | Delete
[3585] Fix | Delete
if ( ! empty( $this->posts ) && $q['update_menu_item_cache'] ) {
[3586] Fix | Delete
update_menu_item_cache( $this->posts );
[3587] Fix | Delete
}
[3588] Fix | Delete
[3589] Fix | Delete
if ( $q['lazy_load_term_meta'] ) {
[3590] Fix | Delete
wp_queue_posts_for_term_meta_lazyload( $this->posts );
[3591] Fix | Delete
}
[3592] Fix | Delete
[3593] Fix | Delete
return $this->posts;
[3594] Fix | Delete
}
[3595] Fix | Delete
[3596] Fix | Delete
/**
[3597] Fix | Delete
* Sets up the amount of found posts and the number of pages (if limit clause was used)
[3598] Fix | Delete
* for the current query.
[3599] Fix | Delete
*
[3600] Fix | Delete
* @since 3.5.0
[3601] Fix | Delete
*
[3602] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[3603] Fix | Delete
*
[3604] Fix | Delete
* @param array $q Query variables.
[3605] Fix | Delete
* @param string $limits LIMIT clauses of the query.
[3606] Fix | Delete
*/
[3607] Fix | Delete
private function set_found_posts( $q, $limits ) {
[3608] Fix | Delete
global $wpdb;
[3609] Fix | Delete
[3610] Fix | Delete
/*
[3611] Fix | Delete
* Bail if posts is an empty array. Continue if posts is an empty string,
[3612] Fix | Delete
* null, or false to accommodate caching plugins that fill posts later.
[3613] Fix | Delete
*/
[3614] Fix | Delete
if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {
[3615] Fix | Delete
return;
[3616] Fix | Delete
}
[3617] Fix | Delete
[3618] Fix | Delete
if ( ! empty( $limits ) ) {
[3619] Fix | Delete
/**
[3620] Fix | Delete
* Filters the query to run for retrieving the found posts.
[3621] Fix | Delete
*
[3622] Fix | Delete
* @since 2.1.0
[3623] Fix | Delete
*
[3624] Fix | Delete
* @param string $found_posts_query The query to run to find the found posts.
[3625] Fix | Delete
* @param WP_Query $query The WP_Query instance (passed by reference).
[3626] Fix | Delete
*/
[3627] Fix | Delete
$found_posts_query = apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) );
[3628] Fix | Delete
[3629] Fix | Delete
$this->found_posts = (int) $wpdb->get_var( $found_posts_query );
[3630] Fix | Delete
} else {
[3631] Fix | Delete
if ( is_array( $this->posts ) ) {
[3632] Fix | Delete
$this->found_posts = count( $this->posts );
[3633] Fix | Delete
} else {
[3634] Fix | Delete
if ( null === $this->posts ) {
[3635] Fix | Delete
$this->found_posts = 0;
[3636] Fix | Delete
} else {
[3637] Fix | Delete
$this->found_posts = 1;
[3638] Fix | Delete
}
[3639] Fix | Delete
}
[3640] Fix | Delete
}
[3641] Fix | Delete
[3642] Fix | Delete
/**
[3643] Fix | Delete
* Filters the number of found posts for the query.
[3644] Fix | Delete
*
[3645] Fix | Delete
* @since 2.1.0
[3646] Fix | Delete
*
[3647] Fix | Delete
* @param int $found_posts The number of posts found.
[3648] Fix | Delete
* @param WP_Query $query The WP_Query instance (passed by reference).
[3649] Fix | Delete
*/
[3650] Fix | Delete
$this->found_posts = (int) apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
[3651] Fix | Delete
[3652] Fix | Delete
if ( ! empty( $limits ) ) {
[3653] Fix | Delete
$this->max_num_pages = (int) ceil( $this->found_posts / $q['posts_per_page'] );
[3654] Fix | Delete
}
[3655] Fix | Delete
}
[3656] Fix | Delete
[3657] Fix | Delete
/**
[3658] Fix | Delete
* Sets up the next post and iterate current post index.
[3659] Fix | Delete
*
[3660] Fix | Delete
* @since 1.5.0
[3661] Fix | Delete
*
[3662] Fix | Delete
* @return WP_Post Next post.
[3663] Fix | Delete
*/
[3664] Fix | Delete
public function next_post() {
[3665] Fix | Delete
[3666] Fix | Delete
++$this->current_post;
[3667] Fix | Delete
[3668] Fix | Delete
/** @var WP_Post */
[3669] Fix | Delete
$this->post = $this->posts[ $this->current_post ];
[3670] Fix | Delete
return $this->post;
[3671] Fix | Delete
}
[3672] Fix | Delete
[3673] Fix | Delete
/**
[3674] Fix | Delete
* Sets up the current post.
[3675] Fix | Delete
*
[3676] Fix | Delete
* Retrieves the next post, sets up the post, sets the 'in the loop'
[3677] Fix | Delete
* property to true.
[3678] Fix | Delete
*
[3679] Fix | Delete
* @since 1.5.0
[3680] Fix | Delete
*
[3681] Fix | Delete
* @global WP_Post $post Global post object.
[3682] Fix | Delete
*/
[3683] Fix | Delete
public function the_post() {
[3684] Fix | Delete
global $post;
[3685] Fix | Delete
[3686] Fix | Delete
if ( ! $this->in_the_loop ) {
[3687] Fix | Delete
// Only prime the post cache for queries limited to the ID field.
[3688] Fix | Delete
$post_ids = array_filter( $this->posts, 'is_numeric' );
[3689] Fix | Delete
// Exclude any falsey values, such as 0.
[3690] Fix | Delete
$post_ids = array_filter( $post_ids );
[3691] Fix | Delete
if ( $post_ids ) {
[3692] Fix | Delete
_prime_post_caches( $post_ids, $this->query_vars['update_post_term_cache'], $this->query_vars['update_post_meta_cache'] );
[3693] Fix | Delete
}
[3694] Fix | Delete
$post_objects = array_map( 'get_post', $this->posts );
[3695] Fix | Delete
update_post_author_caches( $post_objects );
[3696] Fix | Delete
}
[3697] Fix | Delete
[3698] Fix | Delete
$this->in_the_loop = true;
[3699] Fix | Delete
$this->before_loop = false;
[3700] Fix | Delete
[3701] Fix | Delete
if ( -1 == $this->current_post ) { // Loop has just started.
[3702] Fix | Delete
/**
[3703] Fix | Delete
* Fires once the loop is started.
[3704] Fix | Delete
*
[3705] Fix | Delete
* @since 2.0.0
[3706] Fix | Delete
*
[3707] Fix | Delete
* @param WP_Query $query The WP_Query instance (passed by reference).
[3708] Fix | Delete
*/
[3709] Fix | Delete
do_action_ref_array( 'loop_start', array( &$this ) );
[3710] Fix | Delete
}
[3711] Fix | Delete
[3712] Fix | Delete
$post = $this->next_post();
[3713] Fix | Delete
$this->setup_postdata( $post );
[3714] Fix | Delete
}
[3715] Fix | Delete
[3716] Fix | Delete
/**
[3717] Fix | Delete
* Determines whether there are more posts available in the loop.
[3718] Fix | Delete
*
[3719] Fix | Delete
* Calls the {@see 'loop_end'} action when the loop is complete.
[3720] Fix | Delete
*
[3721] Fix | Delete
* @since 1.5.0
[3722] Fix | Delete
*
[3723] Fix | Delete
* @return bool True if posts are available, false if end of the loop.
[3724] Fix | Delete
*/
[3725] Fix | Delete
public function have_posts() {
[3726] Fix | Delete
if ( $this->current_post + 1 < $this->post_count ) {
[3727] Fix | Delete
return true;
[3728] Fix | Delete
} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
[3729] Fix | Delete
/**
[3730] Fix | Delete
* Fires once the loop has ended.
[3731] Fix | Delete
*
[3732] Fix | Delete
* @since 2.0.0
[3733] Fix | Delete
*
[3734] Fix | Delete
* @param WP_Query $query The WP_Query instance (passed by reference).
[3735] Fix | Delete
*/
[3736] Fix | Delete
do_action_ref_array( 'loop_end', array( &$this ) );
[3737] Fix | Delete
// Do some cleaning up after the loop.
[3738] Fix | Delete
$this->rewind_posts();
[3739] Fix | Delete
} elseif ( 0 === $this->post_count ) {
[3740] Fix | Delete
$this->before_loop = false;
[3741] Fix | Delete
[3742] Fix | Delete
/**
[3743] Fix | Delete
* Fires if no results are found in a post query.
[3744] Fix | Delete
*
[3745] Fix | Delete
* @since 4.9.0
[3746] Fix | Delete
*
[3747] Fix | Delete
* @param WP_Query $query The WP_Query instance.
[3748] Fix | Delete
*/
[3749] Fix | Delete
do_action( 'loop_no_results', $this );
[3750] Fix | Delete
}
[3751] Fix | Delete
[3752] Fix | Delete
$this->in_the_loop = false;
[3753] Fix | Delete
return false;
[3754] Fix | Delete
}
[3755] Fix | Delete
[3756] Fix | Delete
/**
[3757] Fix | Delete
* Rewinds the posts and resets post index.
[3758] Fix | Delete
*
[3759] Fix | Delete
* @since 1.5.0
[3760] Fix | Delete
*/
[3761] Fix | Delete
public function rewind_posts() {
[3762] Fix | Delete
$this->current_post = -1;
[3763] Fix | Delete
if ( $this->post_count > 0 ) {
[3764] Fix | Delete
$this->post = $this->posts[0];
[3765] Fix | Delete
}
[3766] Fix | Delete
}
[3767] Fix | Delete
[3768] Fix | Delete
/**
[3769] Fix | Delete
* Iterates current comment index and returns WP_Comment object.
[3770] Fix | Delete
*
[3771] Fix | Delete
* @since 2.2.0
[3772] Fix | Delete
*
[3773] Fix | Delete
* @return WP_Comment Comment object.
[3774] Fix | Delete
*/
[3775] Fix | Delete
public function next_comment() {
[3776] Fix | Delete
++$this->current_comment;
[3777] Fix | Delete
[3778] Fix | Delete
/** @var WP_Comment */
[3779] Fix | Delete
$this->comment = $this->comments[ $this->current_comment ];
[3780] Fix | Delete
return $this->comment;
[3781] Fix | Delete
}
[3782] Fix | Delete
[3783] Fix | Delete
/**
[3784] Fix | Delete
* Sets up the current comment.
[3785] Fix | Delete
*
[3786] Fix | Delete
* @since 2.2.0
[3787] Fix | Delete
*
[3788] Fix | Delete
* @global WP_Comment $comment Global comment object.
[3789] Fix | Delete
*/
[3790] Fix | Delete
public function the_comment() {
[3791] Fix | Delete
global $comment;
[3792] Fix | Delete
[3793] Fix | Delete
$comment = $this->next_comment();
[3794] Fix | Delete
[3795] Fix | Delete
if ( 0 == $this->current_comment ) {
[3796] Fix | Delete
/**
[3797] Fix | Delete
* Fires once the comment loop is started.
[3798] Fix | Delete
*
[3799] Fix | Delete
* @since 2.2.0
[3800] Fix | Delete
*/
[3801] Fix | Delete
do_action( 'comment_loop_start' );
[3802] Fix | Delete
}
[3803] Fix | Delete
}
[3804] Fix | Delete
[3805] Fix | Delete
/**
[3806] Fix | Delete
* Determines whether there are more comments available.
[3807] Fix | Delete
*
[3808] Fix | Delete
* Automatically rewinds comments when finished.
[3809] Fix | Delete
*
[3810] Fix | Delete
* @since 2.2.0
[3811] Fix | Delete
*
[3812] Fix | Delete
* @return bool True if comments are available, false if no more comments.
[3813] Fix | Delete
*/
[3814] Fix | Delete
public function have_comments() {
[3815] Fix | Delete
if ( $this->current_comment + 1 < $this->comment_count ) {
[3816] Fix | Delete
return true;
[3817] Fix | Delete
} elseif ( $this->current_comment + 1 == $this->comment_count ) {
[3818] Fix | Delete
$this->rewind_comments();
[3819] Fix | Delete
}
[3820] Fix | Delete
[3821] Fix | Delete
return false;
[3822] Fix | Delete
}
[3823] Fix | Delete
[3824] Fix | Delete
/**
[3825] Fix | Delete
* Rewinds the comments, resets the comment index and comment to first.
[3826] Fix | Delete
*
[3827] Fix | Delete
* @since 2.2.0
[3828] Fix | Delete
*/
[3829] Fix | Delete
public function rewind_comments() {
[3830] Fix | Delete
$this->current_comment = -1;
[3831] Fix | Delete
if ( $this->comment_count > 0 ) {
[3832] Fix | Delete
$this->comment = $this->comments[0];
[3833] Fix | Delete
}
[3834] Fix | Delete
}
[3835] Fix | Delete
[3836] Fix | Delete
/**
[3837] Fix | Delete
* Sets up the WordPress query by parsing query string.
[3838] Fix | Delete
*
[3839] Fix | Delete
* @since 1.5.0
[3840] Fix | Delete
*
[3841] Fix | Delete
* @see WP_Query::parse_query() for all available arguments.
[3842] Fix | Delete
*
[3843] Fix | Delete
* @param string|array $query URL query string or array of query arguments.
[3844] Fix | Delete
* @return WP_Post[]|int[] Array of post objects or post IDs.
[3845] Fix | Delete
*/
[3846] Fix | Delete
public function query( $query ) {
[3847] Fix | Delete
$this->init();
[3848] Fix | Delete
$this->query = wp_parse_args( $query );
[3849] Fix | Delete
$this->query_vars = $this->query;
[3850] Fix | Delete
return $this->get_posts();
[3851] Fix | Delete
}
[3852] Fix | Delete
[3853] Fix | Delete
/**
[3854] Fix | Delete
* Retrieves the currently queried object.
[3855] Fix | Delete
*
[3856] Fix | Delete
* If queried object is not set, then the queried object will be set from
[3857] Fix | Delete
* the category, tag, taxonomy, posts page, single post, page, or author
[3858] Fix | Delete
* query variable. After it is set up, it will be returned.
[3859] Fix | Delete
*
[3860] Fix | Delete
* @since 1.5.0
[3861] Fix | Delete
*
[3862] Fix | Delete
* @return WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object.
[3863] Fix | Delete
*/
[3864] Fix | Delete
public function get_queried_object() {
[3865] Fix | Delete
if ( isset( $this->queried_object ) ) {
[3866] Fix | Delete
return $this->queried_object;
[3867] Fix | Delete
}
[3868] Fix | Delete
[3869] Fix | Delete
$this->queried_object = null;
[3870] Fix | Delete
$this->queried_object_id = null;
[3871] Fix | Delete
[3872] Fix | Delete
if ( $this->is_category || $this->is_tag || $this->is_tax ) {
[3873] Fix | Delete
if ( $this->is_category ) {
[3874] Fix | Delete
$cat = $this->get( 'cat' );
[3875] Fix | Delete
$category_name = $this->get( 'category_name' );
[3876] Fix | Delete
[3877] Fix | Delete
if ( $cat ) {
[3878] Fix | Delete
$term = get_term( $cat, 'category' );
[3879] Fix | Delete
} elseif ( $category_name ) {
[3880] Fix | Delete
$term = get_term_by( 'slug', $category_name, 'category' );
[3881] Fix | Delete
}
[3882] Fix | Delete
} elseif ( $this->is_tag ) {
[3883] Fix | Delete
$tag_id = $this->get( 'tag_id' );
[3884] Fix | Delete
$tag = $this->get( 'tag' );
[3885] Fix | Delete
[3886] Fix | Delete
if ( $tag_id ) {
[3887] Fix | Delete
$term = get_term( $tag_id, 'post_tag' );
[3888] Fix | Delete
} elseif ( $tag ) {
[3889] Fix | Delete
$term = get_term_by( 'slug', $tag, 'post_tag' );
[3890] Fix | Delete
}
[3891] Fix | Delete
} else {
[3892] Fix | Delete
// For other tax queries, grab the first term from the first clause.
[3893] Fix | Delete
if ( ! empty( $this->tax_query->queried_terms ) ) {
[3894] Fix | Delete
$queried_taxonomies = array_keys( $this->tax_query->queried_terms );
[3895] Fix | Delete
$matched_taxonomy = reset( $queried_taxonomies );
[3896] Fix | Delete
$query = $this->tax_query->queried_terms[ $matched_taxonomy ];
[3897] Fix | Delete
[3898] Fix | Delete
if ( ! empty( $query['terms'] ) ) {
[3899] Fix | Delete
if ( 'term_id' === $query['field'] ) {
[3900] Fix | Delete
$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
[3901] Fix | Delete
} else {
[3902] Fix | Delete
$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
[3903] Fix | Delete
}
[3904] Fix | Delete
}
[3905] Fix | Delete
}
[3906] Fix | Delete
}
[3907] Fix | Delete
[3908] Fix | Delete
if ( ! empty( $term ) && ! is_wp_error( $term ) ) {
[3909] Fix | Delete
$this->queried_object = $term;
[3910] Fix | Delete
$this->queried_object_id = (int) $term->term_id;
[3911] Fix | Delete
[3912] Fix | Delete
if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {
[3913] Fix | Delete
_make_cat_compat( $this->queried_object );
[3914] Fix | Delete
}
[3915] Fix | Delete
}
[3916] Fix | Delete
} elseif ( $this->is_post_type_archive ) {
[3917] Fix | Delete
$post_type = $this->get( 'post_type' );
[3918] Fix | Delete
[3919] Fix | Delete
if ( is_array( $post_type ) ) {
[3920] Fix | Delete
$post_type = reset( $post_type );
[3921] Fix | Delete
}
[3922] Fix | Delete
[3923] Fix | Delete
$this->queried_object = get_post_type_object( $post_type );
[3924] Fix | Delete
} elseif ( $this->is_posts_page ) {
[3925] Fix | Delete
$page_for_posts = get_option( 'page_for_posts' );
[3926] Fix | Delete
[3927] Fix | Delete
$this->queried_object = get_post( $page_for_posts );
[3928] Fix | Delete
$this->queried_object_id = (int) $this->queried_object->ID;
[3929] Fix | Delete
} elseif ( $this->is_singular && ! empty( $this->post ) ) {
[3930] Fix | Delete
$this->queried_object = $this->post;
[3931] Fix | Delete
$this->queried_object_id = (int) $this->post->ID;
[3932] Fix | Delete
} elseif ( $this->is_author ) {
[3933] Fix | Delete
$author = (int) $this->get( 'author' );
[3934] Fix | Delete
$author_name = $this->get( 'author_name' );
[3935] Fix | Delete
[3936] Fix | Delete
if ( $author ) {
[3937] Fix | Delete
$this->queried_object_id = $author;
[3938] Fix | Delete
} elseif ( $author_name ) {
[3939] Fix | Delete
$user = get_user_by( 'slug', $author_name );
[3940] Fix | Delete
[3941] Fix | Delete
if ( $user ) {
[3942] Fix | Delete
$this->queried_object_id = $user->ID;
[3943] Fix | Delete
}
[3944] Fix | Delete
}
[3945] Fix | Delete
[3946] Fix | Delete
$this->queried_object = get_userdata( $this->queried_object_id );
[3947] Fix | Delete
}
[3948] Fix | Delete
[3949] Fix | Delete
return $this->queried_object;
[3950] Fix | Delete
}
[3951] Fix | Delete
[3952] Fix | Delete
/**
[3953] Fix | Delete
* Retrieves the ID of the currently queried object.
[3954] Fix | Delete
*
[3955] Fix | Delete
* @since 1.5.0
[3956] Fix | Delete
*
[3957] Fix | Delete
* @return int
[3958] Fix | Delete
*/
[3959] Fix | Delete
public function get_queried_object_id() {
[3960] Fix | Delete
$this->get_queried_object();
[3961] Fix | Delete
[3962] Fix | Delete
if ( isset( $this->queried_object_id ) ) {
[3963] Fix | Delete
return $this->queried_object_id;
[3964] Fix | Delete
}
[3965] Fix | Delete
[3966] Fix | Delete
return 0;
[3967] Fix | Delete
}
[3968] Fix | Delete
[3969] Fix | Delete
/**
[3970] Fix | Delete
* Constructor.
[3971] Fix | Delete
*
[3972] Fix | Delete
* Sets up the WordPress query, if parameter is not empty.
[3973] Fix | Delete
*
[3974] Fix | Delete
* @since 1.5.0
[3975] Fix | Delete
*
[3976] Fix | Delete
* @see WP_Query::parse_query() for all available arguments.
[3977] Fix | Delete
*
[3978] Fix | Delete
* @param string|array $query URL query string or array of vars.
[3979] Fix | Delete
*/
[3980] Fix | Delete
public function __construct( $query = '' ) {
[3981] Fix | Delete
if ( ! empty( $query ) ) {
[3982] Fix | Delete
$this->query( $query );
[3983] Fix | Delete
}
[3984] Fix | Delete
}
[3985] Fix | Delete
[3986] Fix | Delete
/**
[3987] Fix | Delete
* Makes private properties readable for backward compatibility.
[3988] Fix | Delete
*
[3989] Fix | Delete
* @since 4.0.0
[3990] Fix | Delete
*
[3991] Fix | Delete
* @param string $name Property to get.
[3992] Fix | Delete
* @return mixed Property.
[3993] Fix | Delete
*/
[3994] Fix | Delete
public function __get( $name ) {
[3995] Fix | Delete
if ( in_array( $name, $this->compat_fields, true ) ) {
[3996] Fix | Delete
return $this->$name;
[3997] Fix | Delete
}
[3998] Fix | Delete
}
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function