我正在尝试显示一个名为CursosTL
但我在使用以下代码时出错。
function elc_cursos_en_el_blog() {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( \'post_type\', array( \'post\', \'CursoTL\' ));
}
}
add_action( \'pre_get_posts\', \'elc_cursos_en_el_blog\' );
错误是:
Stack trace:
#0 wp-includes/class-wp-hook.php(287): elc_cursos_en_el_blog(Object(WP_Query))
#1 wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(\'\', Array)
#2 wp-includes/plugin.php(551): WP_Hook->do_action(Array)
#3 wp-includes/class-wp-query.php(1779): do_action_ref_array(\'pre_get_posts\', Array)
#4 wp-includes/class-wp-query.php(3448): WP_Query->get_posts()
#5 wp-includes/post.php(2065): WP_Query->query(Array)
#6 wp-content/plugins/amp/includes/admin/functions.php(```
有什么帮助吗?PHP是7.4版。