Use this
$product_terms = wp_get_object_terms( 17, 'product_cat', array( 'fields' => 'all' ) );
and then get the parent cat id and move all sub cat into an array.
Related Posts:
- Translate a plugin using .po .mo files
- How can I create a bash install script for my WordPress sites setup (WP+plugins+theme)?
- Sending all emails using SMTP
- __(): What if I have to pass in a variable?
- How to make Pull Requests on a wordpress.org plugin?
- Custom Taxonomy in plugin and template
- Should we use plugins that aren’t available from the official WordPress site?
- Where can I propose a new plugin?
- Disallow a user to post in certain categories
- Why allow overriding crucial pluggable functions wp_verify_nonce and wp_create_nonce?
- is_post_type_archive not working in feed
- How to edit plugin’s html? [closed]
- Taking WordPress table prefixes into account
- Changing BIGINT to INT
- Datepicker not supporting timepicker
- Add a Custom Permalink option in the Permalink Admin Screen?
- add_filter the_content in functions.php not working
- Escape special characters in image link
- Disable WordPress password reset via mails,instead notify admin about the reset request
- Can’t use the built-in wordpress install/upgrade plugin feature [closed]
- publish_post plugin hook doesn’t always pass $post->post_content
- Let user subscribe to specific categories
- WP Customer Reviews – shortcodes
- How to get a Jewish/English event calendar on a page in WordPress?
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- How to stop xmlrpc attacks without disabling component to allow JetPack to work in WordPress?
- Do action only on certain front end pages?
- Make menu page link inaccessible or disabled
- Advanced Custom Fields plugin – get text from editor field and save it in a variable
- How organize uploaded media in WP?
- Archive – same title for the first two posts
- Build a list of partners with Link, Logo and text
- How to resolve error after installing plugin? [closed]
- How to hide some section in WordPress under Post
- is there a way to link one of the field in ACF field group, to a field in a media attachment page? [closed]
- Rewrite rule not matching
- Lock access to plugin options
- Get errors from WP_Error to different variables
- Call specific plugin update
- How to get post ID with hooks publish_post, new_to_publish, etc
- Always get creating a new table with foreign key
- Add text to variable
- How do I add $_SESSION[”] to my wordpress page?
- Search users with custom meta data
- How to change layout of shop page in wordpress? [closed]
- If post exists in the database – each time goes on `else`
- override function from my plugin [closed]
- How can I achieve this, using shortcodes
- Woocommerce Product Page edit “from” text [closed]
- Multiple images per post – Show random image elsewhere
- Edit part of a post
- Display hReviews from other websites such as yelp on your site?
- Sociable buttons displaying seemingly at random [closed]
- WordPress Membership Plugin Advice [closed]
- How to fix these PHP Warnings with the “Feed JSON” plug-in?
- Hook for plugin to insert into entry-meta
- Installed WordPress.com Stats with api key and forgot key. How can I register w/ new key?
- In a local wordpress installation, when I install a plugin it only offers me installation via FTP
- Use localized plugin name and description even when the plugin is disabled
- how to show new field if option selected?
- Give custom page template a custom post ID
- Bookmarking custom template pages which all have the same page ID
- Randomize post (and page) IDs on generation
- Any tips for a plugin to define specific pages navigation for specific types of users / members? [closed]
- Moving all wordpress posts from 50 websites to another website
- My wordpress local urls is still displayed even moved to live
- How to store a custom theme and update it on other installations
- How to Unhook actions/filters in within Class in plugin
- One time call to external API in widget
- Hide Featured Image in AMP
- get_posts query results out of order but shows correct in php snippets plugin
- Add two row of code to the public static function init of a plugin
- WordPress filter from custom table is not working properly
- How to restrict the user from viewing comments but with option to write comments?
- Dynamically Modify s2member Options
- WordPress scheduled event not working
- What action/hook do I need to register to have my plugin handle front-end editing?
- plugin_dir_url(__FILE__) searches parent theme in ACF extension
- Plugin with AJAX on subdomains causes 404 in console
- Do something with thumbnail image on post publish
- Trouble cloning a live WordPress site to a new site on a local server?
- Option page not updating multiple records in settings api
- WordPress plugin addon [closed]
- Displaying saved category checked in a plugin?
- The plugin generated XXX characters of unexpected output…help?
- Using “Authy Two Factor Authentication” in custom login page
- JSON Feed on my wordpress Blog
- Thumbnails have stopped generating correctly
- Managing database tables in WordPress multisite
- get_posts() method and paging is not working
- plugin for different writers [closed]
- What is the source outline for a basic word press plugin?
- WordPress Site in Multiple Languages
- Internet Explorer seperating lists differently in Twitter Widget Pro than all other browsers [closed]
- WordPress In Menu
- How can I add only related products?
- How to make horizontal scrolling menu [closed]
- how to embed a crop feature for cropping images uploaded by the user
- Create Custom Coupon Type
- Text Wrapping in WPDataTables