solved it so:
$part_brand = get_terms('brands', 'hide_empty=0');
<label for="part_brand">Бренд</label>
<select name="part_brand" id='part_brand'>
<option value=""
<?php
**$brand_names = wp_get_object_terms($post->ID, 'brands');**
if (!count($brand_names)) echo "selected"; ?>>None</option>
<?php
foreach($part_brand as $brand)
{
if (!is_wp_error($brand_names) && !empty($brand_names) && !strcmp($brand->slug, $brand_names[0]->slug)) echo "<option value="" . $brand->slug . "" selected>" . $brand->name . "</option>\n";
else echo "<option value="" . $brand->slug . "">" . $brand->name . "</option>\n";
}
?>
</select>
Related Posts:
- Get product attribute for Simple product in WooCommerce
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- CSS from textarea in options page to frontend what to do
- How to sanitize uploaded file filename from a plugin?
- WordPress custom taxonomy not showing
- Getting taxonomy images to display on single-post with their terms
- Get product categories and add them to a custom taxonomy
- Show custom taxonomy in theme
- Award points if a specific custom taxonomy is selected – Cubepoints
- Get total number of comment of the posts written by an author
- How do you remove plugin edit option?
- Escape when echoed
- Scope for PHP Variables Assigned in functions.php or a plugin
- add_meta_box (Will display only in specific page admin WordPress)
- Make specific products accessible only to a user role in WooCommerce
- force customers to add only single item to card per purchase EDD [closed]
- Undefined property: WP_Post_Type::$ID
- Plugin exceeds memory limit
- How to get post URL in the_content filter?
- How to remove xmlns on language_attributes()?
- How to write one comment and publish on every post using database or plugin?
- Add a plugin before main container
- Shortcode to generate and save password in a file
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to get member list based on role by using buddypress?
- I don’t understand how this parameter works..?
- Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
- How to initialize something in unit test before the init hook being called?
- Show Heirachy of categories in WP Download Monitor
- Custom Taxonomy Tag Search
- Add custom taxonomy to title tag [closed]
- Possible to replicate economist.com’s debate section in wordpress? [closed]
- Missing argument 3 for wp_register_sidebar_widget()
- Make id column as AUTO INCREMENT on plugin activation
- How to Include a Loop Template File in a Plugin
- Write to / remove from default .htaccess file from plugin?
- Update Option Error: Notice: Undefined index
- How can I display a contact form for out of stock products in WooCommerce?
- Pass a php string to a javascript variable
- get shortcode value
- How to get number of Affected rows from wordpress dbDelta() function
- Show price with Geo IP location
- WordPress Ajax Callback
- Add category to body class
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- Plugin Development sqlite or WordPress’ database
- How to review WordPress website php version compatibility?
- printf – problem to understand code
- Do We Need to Validate, Sanitize, or Filter Simple Numerical Superglobals (Cookies and Post)?
- Custom Post Type Plugin not loading category template and loading 404 instead
- Sending email from inside a plugin using PHP PEAR
- Auto delete WordPress users according to time
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How to trigger $_GET request within admin plugin page?
- Wp favorite posts get user favorites in profile using buddypress [closed]
- Storing Options in a Shortcode
- Why isn’t admin_notices displaying my text? [Simple Plugin, Beginner]
- How to generate video out of images via WordPress plugin
- How can I get WordPress to save comments in markdown format?
- add_query_arg not working
- problems with wordpress and php version 5.3.3-1
- WP plugins for building a database?
- WooCommerce get_price returning wrong price when used via ajax
- How to ‘clone’ a wp plugin to make small changes
- Open Post Thumbnail in New Child Theme File in WordPress
- add mediaelement.js plugins into WordPress video player control bar
- MITM risk of not sanitizing?
- Shortcode button dosent work for all posts. Work for first post only
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Which escape function to use when escaping an email or plain text?
- Where should I save an API key of my user when installing my plugin?
- Prevent a plugin from being automatically activated
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Programatically download a plugin
- Accessing post’s meta data based on user’s click of a post
- WordPress category add image field
- Error shown for Trying to get property ‘roles’ of non-object in WordPress After Content for User Roles
- Preferred way of cacheing a value in php
- Redirecting to home page after login as custom role WordPress
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- How to Use Parameters with a Do_Action Function Within PHP Tags
- Add keywords meta to index.php page
- Custom form action to handle data inside a plugin
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Where (or when) should I register a new taxonomy?
- Add Product Subtitle to Woocommerce Product Page
- Self deactivate plugins after an action occurs
- wp_redirect() not working in Insert PHP plugin in WordPress
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- woocommerce 3.2.1 not sending order notification emails
- WordPress takes too much time (100 seconds) to load – Front end and back end
- Limit Number of Taxonomy Terms (Images) Displayed
- Widget for adding HTML markup to a page
- How I can get custom field’s current value?
- WordPress on AWS with ELB
- Saving changes in wp_editor
- Executing my function once on a specific time
- Set Post Format if find a string in title or post content