Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. wordpress get_terms function not working in my plugin
  2. $terms = get_terms($taxonomy , 'hide_empty=0');
  3. print_r($terms);
  4. $count = count($terms);
  5. if ( $count > 0 ){
  6. echo "<ul>";
  7. foreach ( $terms as $term ) {
  8.   echo "<li>" . $term->name . "</li>";
  9.  
  10. }
  11. echo "</ul>";
  12.    
  13. WP_Error Object
  14. (
  15.     [errors] => Array
  16.         (
  17.             [invalid_taxonomy] => Array
  18.                 (
  19.                     [0] => Invalid Taxonomy
  20.                 )
  21.  
  22.         )
  23.  
  24.     [error_data] => Array
  25.         (
  26.         )
  27.  
  28. )
  29.    
  30. function load_terms($taxonomy){
  31.     global $wpdb;
  32.     $query = 'SELECT DISTINCT
  33.                                 t.name
  34.                             FROM
  35.                                 `wp-cls`.wp_terms t
  36.                             INNER JOIN
  37.                                 `wp-cls`.wp_term_taxonomy tax
  38.                             ON
  39.                              `tax`.term_id = `t`.term_id
  40.                             WHERE
  41.                                 ( `tax`.taxonomy = '' . $taxonomy . '')';                    
  42.     $result =  $wpdb->get_results($query , ARRAY_A);
  43.     return $result;                
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top