cara menghapus produk ke loop toko melalui id produk dengan Contoh

Dalam artikel ini, saya akan memberi Anda contoh kode spesifik yang menjawab pertanyaan cara menghapus produk ke loop toko melalui id produk dengan Contoh and share my response with you. I hope that the article will assist you in working more quickly

cara menghapus produk ke loop toko melalui id produk dengan Contoh - cara menghapus produk ke loop toko melalui id produk
add_action('pre_get_posts', 'remove_products_from_shop_page');

function remove_products_from_shop_page($q)
{
	$rm_products = array();
	if (!$q->is_main_query()) return;
	if (!$q->is_post_type_archive()) return;
	if (is_shop()) {
		$q->set('post__not_in', $rm_products);
		return $q;
	}
	remove_action('pre_get_posts', 'remove_products_from_shop_page');
}
// $rm_products Is array and equal to your products id

Lebih banyak contoh ilustratif seputar pertanyaan bagaimana cara menghapus produk ke loop toko melalui id produk dengan Contoh. Berharap untuk membantu Anda lebih cepat

tidak terdefinisi