我的店铺中有一个名为“Test\\u category”的产品类别。特别是,我想从我的商店中隐藏这个所有产品,只隐藏一段时间,不从管理员处删除或设置状态为挂起。
当做
我的店铺中有一个名为“Test\\u category”的产品类别。特别是,我想从我的商店中隐藏这个所有产品,只隐藏一段时间,不从管理员处删除或设置状态为挂起。
当做
将下面的钩子添加到主题函数中。php文件
add_action( \'pre_get_posts\', \'custom_pre_get_posts\' );
function custom_pre_get_posts( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() && is_shop() ) {
$q->set( \'tax_query\', array(array(
\'taxonomy\' => \'product_cat\',
\'field\' => \'slug\',
\'terms\' => array( \'private-clients\', \'charity\'), // Don\'t display products in the private-clients category on the shop page
\'operator\' => \'NOT IN\'
)));
}
remove_action( \'pre_get_posts\', \'custom_pre_get_posts_query\' );
}
我想知道如何才能找到插件的slug(slug=WordPress用来更新插件和确定哪些插件当前处于活动状态的内部名称)?它通常是插件的文件夹名,但如果插件没有文件夹,则是其文件名(如hello.php)。是否有其他例外情况?大小写字符重要吗</插件的slug是否可以与其文件夹名不同?如果有一个叫做hello的插件呢。php和另一个/您好。php/您好。php