{"id":12756685,"date":"2020-04-30T09:34:12","date_gmt":"2020-04-30T09:34:12","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/sidebar-and-default-category\/"},"modified":"2020-04-30T09:34:12","modified_gmt":"2020-04-30T09:34:12","slug":"sidebar-and-default-category","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/sidebar-and-default-category\/","title":{"rendered":"Sidebar and Default Category"},"content":{"rendered":"<p>hi,<\/p>\n<p>2 questions:<\/p>\n<p>1- I can not disable sidebar, i tryed from backoffice to uncheck, but does not work.<\/p>\n<p>2- Is it possible to set a default category when a vendor upload a new product?<br \/>\nI used this code to auto create a product when a vendor create an account, and it is working, but no category is assegned to the product:<\/p>\n<p>add_action( &#8216;wcfmmp_new_store_created&#8217;, function( $member_id, $wcfmmp_settings ) {<br \/>\n\t$product_args = array(<br \/>\n\t\t\t\t\t\t\t\t\t\t\t\t&#8216;post_title&#8217;   =&gt; &#8216;Donacion&#8217;,<br \/>\n\t\t\t\t\t\t\t\t\t\t\t\t&#8216;post_status&#8217;  =&gt; &#8216;publish&#8217;,<br \/>\n\t\t\t\t\t\t\t\t\t\t\t\t&#8216;post_type&#8217;    =&gt; &#8216;product&#8217;,<br \/>\n\t\t\t\t\t\t\t\t\t\t\t\t&#8216;post_author&#8217;  =&gt; $member_id,<br \/>\n\t\t\t\t\t\t\t\t\t\t\t\t&#8216;post_name&#8217;    =&gt; sanitize_title(&#8216;Donacion&#8217;)<br \/>\n\t\t\t\t\t\t\t\t\t\t\t);<br \/>\n\t$new_product_id = wp_insert_post( $product_args, true );<br \/>\n\tupdate_post_meta( $new_product_id, &#8216;_wcfm_product_author&#8217;, $member_id );<\/p>\n<p>\t\/\/ Set Product Type<br \/>\n\twp_set_object_terms( $new_product_id, &#8216;simple&#8217;, &#8216;product_type&#8217; );<\/p>\n<p>\t\/\/ Set Price<br \/>\n\tupdate_post_meta( $new_product_id, &#8216;_regular_price&#8217;, &#8217;10&#8217; );<br \/>\n\tupdate_post_meta( $new_product_id, &#8216;_price&#8217;, &#8217;10&#8217; );<br \/>\n}, 50, 2 );<\/p>\n<p>Thanks a lot your plugin Rock !!!<\/p>\n","protected":false},"template":"","class_list":["post-12756685","topic","type-topic","status-publish","hentry","topic-tag-category","topic-tag-sidebar"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12756685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12756685\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12756685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}