wordpress - How to set custom filler for product attributes like SIZE,COLOUR,PRICE,etc -
how set custom fillter product attributes size,colour,price,etc , knw there many plugin want custom code fillter.
product attributes rows in table wp_postmeta
. can select corresponding posts building query on tables wp_posts
, wp_postmeta
. here example using $wpdb->prepare()
, $wpdb->get_results()
:
$posts = $wpdb->get_results( $wpdb->prepare( "select p.* {$wpdb->posts} p, {$wpdb->postmeta} m ". "where p.id = m.post_id , m.meta_key = %s , m.meta_value = %s ". "and p.post_status = 'publish' ". "and p.post_type = '<your_post_type>', array($attribute_name, $attribute_value) ) );
Comments
Post a Comment