Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wordpress get_terms function not working in my plugin
- $terms = get_terms($taxonomy , 'hide_empty=0');
- print_r($terms);
- $count = count($terms);
- if ( $count > 0 ){
- echo "<ul>";
- foreach ( $terms as $term ) {
- echo "<li>" . $term->name . "</li>";
- }
- echo "</ul>";
- WP_Error Object
- (
- [errors] => Array
- (
- [invalid_taxonomy] => Array
- (
- [0] => Invalid Taxonomy
- )
- )
- [error_data] => Array
- (
- )
- )
- function load_terms($taxonomy){
- global $wpdb;
- $query = 'SELECT DISTINCT
- t.name
- FROM
- `wp-cls`.wp_terms t
- INNER JOIN
- `wp-cls`.wp_term_taxonomy tax
- ON
- `tax`.term_id = `t`.term_id
- WHERE
- ( `tax`.taxonomy = '' . $taxonomy . '')';
- $result = $wpdb->get_results($query , ARRAY_A);
- return $result;
- }
Add Comment
Please, Sign In to add comment