我正试图从中获取代码site. 它的问题是,我怀疑它是从非php解析浏览器中复制和粘贴的。我尝试了各种方法来让正确的角色工作,但它不断破坏我的本地开发网站。代码如下:
// Set any Custom Post Type to be displayed on the archive.php and tag.php
function category_tag_archives( $wp_query ) {
if ( $wp_query->get( ‘category_name’ ) || $wp_query-
>get( ‘cat’ ) || $wp_query->get( ‘tag’ ) )
$wp_query->set( ‘post_type’, ‘any’ );
}
add_action( ‘pre_get_posts’, ‘category_tag_archives’ );
我要解释的是:$wp_query->set
我尝试了以下组合:$wp_query-&>set
以及$wp_query=&>set
但没有快乐。。。谢谢大家的帮助!
(PS此功能的目的是允许存档从WP页面而不是WP帖子发布内容循环)