<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[우커머스 Shop 페이지 카테고리 설정]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/34202</link>
		<description><![CDATA[<p>안녕하세요. 현재 우커머스 Shop 페이지를 들어가게되면 설정한것에 따라 모든 상품이 한번에 나열됩니다.(카달로그)</p>

<p>그런데 여기서 저는 etc 라는 카테고리에 있는 물품들은 제외하고 싶습니다.</p>

<p>etc, a, b 라는 카테고리가 있으면 shop 페이지에 카달로그는 a,b에 속한 상품만 보이게요.</p>

<p>그리고 따로 etc 카테고리에 들어가게되면 그제서야 etc에 있는 상품을 볼수있게 하고 싶습니다.</p>

<pre>
<code>    function custom_pre_get_posts_query( $q ) {
        
        $tax_query = (array) $q-&gt;get( 'tax_query' );
        
        $tax_query[] = array(
                             'taxonomy' =&gt; 'product_cat',
                             'field' =&gt; 'slug',
                             'terms' =&gt; array( 'etc' ), // Don't display products in the clothing category on the shop page.
                             'operator' =&gt; 'NOT IN'
                             );
        
        
        $q-&gt;set( 'tax_query', $tax_query );
        
    }</code></pre>

<p> </p>

<p>열심히 구글링을 통해서 관련 코드를 찾았습니다.</p>

<p> </p>

<p>분명 첫페이지 카달로그까지는 정상 작동을 했는데.. 문제는 etc 라는 카테고리에 들어가면 거기서도 상품이 안보이더라구요..</p>

<p><a href="https://mfsound.co.kr/shop/">https://mfsound.co.kr/shop/</a> 이 주소에서는 보이지 않고 </p>

<p><a href="https://mfsound.co.kr/product-category/etc/">https://mfsound.co.kr/product-category/etc/</a> 이 주소에서만 확인이 가능하게 하고 싶습니다.</p>

<p>가능할까요?</p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[안녕하세요~^^

아래 링크를 참고하신 건지요?

https://docs.woocommerce.com/document/exclude-a-cate...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/34206</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>아래 링크를 참고하신 건지요?</p>

<p><a href="https://docs.woocommerce.com/document/exclude-a-category-from-the-shop-page/" target="_blank">https://docs.woocommerce.com/document/exclude-a-category-from-the-shop-page/</a></p>

<p> </p>

<p>$q-&gt;queried_object-&gt;name 변수를 활용해보는 건 어떨까 합니다.</p>

<p>기존의 코드 대신</p>

<p>아래의 코드로 교체해서 확인해보시겠어요?</p>

<pre>
<code class="language-php">function custom_pre_get_posts_query( $q ) {
	if(!(isset($q-&gt;queried_object-&gt;name)&amp;&amp;$q-&gt;queried_object-&gt;name == 'etc')){
		$tax_query = (array) $q-&gt;get( 'tax_query' );
		
		$tax_query[] = array(
			'taxonomy' =&gt; 'product_cat',
			'field' =&gt; 'slug',
			'terms' =&gt; array('etc'), // Don't display products in the clothing category on the shop page.
			'operator' =&gt; 'NOT IN'
		);
		
		
		$q-&gt;set( 'tax_query', $tax_query );
	}
}
add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' ); </code></pre>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Fri, 21 Jun 2019 08:07:19 +0000</pubDate>
			<category>우커머스(WooCommerce)</category>
		</item>
			</channel>
</rss>