<?php
// PHP & SQL get all tags of woo product by ID
if (!empty($_GET['gtags'])) {
global $wpdb;
// $table = $wpdb->prefix . 'posts'; // $table_prefix = 'atesvn_';
//
$sql = "SELECT `t`.`term_id` AS `tag_id`, `t`.`name` AS `tag_title`, `t`.`slug` AS `tag_slug` FROM `atesvn_terms` AS `t` INNER JOIN `atesvn_term_taxonomy` AS `tt` ON `t`.`term_id` = `tt`.`term_id` INNER JOIN `atesvn_term_relationships` AS `tr` ON `tt`.`term_taxonomy_id` = `tr`.`term_taxonomy_id` WHERE `tt`.`taxonomy` = 'product_tag' AND `tr`.`object_id` = 3312;";
//
$results = $wpdb->get_results($sql, ARRAY_A);
print_r($results); exit;
} // OKAY

Bài viết cùng chuyên mục, chủ đề