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 ?

本文标签: