admin管理员组文章数量:1122832
I recently update php from 7.4 to 8.0 , since many functions doesn't work anymore ! I don't know if it's related but I have tried many solutions and none of them works.
Using (get_...) , the_title
, the_excerpt
, the_content
, etc inside new WP_Query
and below conditions loop nothing are displayed .
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
var_dump(get_the_title());
endwhile;
endif;
Strangely $post_id = get_the_id()
and the_post_thumbnail()
work !
If I use get_posts() : $postsA = get_posts($Activities)[0]; $postsA->post_title
inside the loop I retrieve the title.
If I use get_the_title($post_id)
or get_the_title()
or the_title()
I have nothing. = NULL
My arguments :
$Activities = array(
'post_type' => $activityType,
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'timestamps_between',
'value' => array($firstdayweek_ts,$lastdaymidnight_ts),
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
)
)
);
$the_query = new WP_Query( $Activities );
My host charges for downgrading because it no longer guarantees stability.
I have tried with a simple loop (no argument) it's the same issue but get_the_id()
return well the id of post.
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
var_dump(get_the_title());
endwhile;
endif;
Do you have an idea where the problem come ?
本文标签:
版权声明:本文标题:WordPress current post functions inside loop doesn't work anymore, are they incompatible with php 8.0? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736310135a1934267.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论