Wordpress获取具有匹配帖子内容的帖子id

Wordpress获取具有匹配帖子内容的帖子id,wordpress,Wordpress,在Wordpress中有没有一种方法可以让我生成帖子内容的子字符串,并提供帖子id 提前感谢。可以使用WordPress的awesome WP查询类和搜索参数来实现。e、 g.以下查询将搜索任何包含“hello”字样的帖子,并根据需要显示其帖子ID: <?php // 's' parameter is for search $the_query = new WP_Query( array( 's' => 'hello' ) ); if ( $the_

Wordpress
中有没有一种方法可以让我生成帖子内容的
子字符串
,并提供帖子id


提前感谢。

可以使用WordPress的awesome WP查询类和搜索参数来实现。e、 g.以下查询将搜索任何包含“hello”字样的帖子,并根据需要显示其帖子ID:

<?php
     // 's' parameter is for search
    $the_query = new WP_Query( array( 's' => 'hello' ) );

       if ( $the_query->have_posts() ) {
          while ( $the_query->have_posts() ) {
              $the_query->the_post();
     //now we can echo anything we want like e.g. IDs
              echo get_the_ID();
        }

       } else {
                 // no posts found
       }
         /* Restore original Post Data */
         wp_reset_postdata();

 ?>

可以使用WordPress的awesome WP查询类和搜索参数来实现。e、 g.以下查询将搜索任何包含“hello”字样的帖子,并根据需要显示其帖子ID:

<?php
     // 's' parameter is for search
    $the_query = new WP_Query( array( 's' => 'hello' ) );

       if ( $the_query->have_posts() ) {
          while ( $the_query->have_posts() ) {
              $the_query->the_post();
     //now we can echo anything we want like e.g. IDs
              echo get_the_ID();
        }

       } else {
                 // no posts found
       }
         /* Restore original Post Data */
         wp_reset_postdata();

 ?>


您是在问摘录吗?您是在问摘录吗?