$wpdb select all meta for each post

This is really simple. get_post_meta($postid); This will return all values in about the same syntax. In a more workable loop: <?php $custom = new WP_Query(array(“posts_per_page” => -1)) if( $custom->have_posts() ) { while ( $custom->have_posts() ) { the_post(); $data = get_post_meta(get_the_ID()); } } else { /* No posts found */ } ?>

Get terms that contain posts that in turn belong to other terms?

This should get you the names of all such terms in an array $wpdb->get_col(“SELECT DISTINCT {$wpdb->terms}.name FROM {$wpdb->terms} INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id INNER JOIN {$wpdb->term_relationships} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id WHERE {$wpdb->term_taxonomy}.taxonomy = ‘shape’ AND {$wpdb->term_relationships}.object_id IN ( SELECT object_id FROM {$wpdb->term_relationships} INNER JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id WHERE {$wpdb->term_taxonomy}.taxonomy = ‘color’ … Read more

Undefined offset: 0

Fixed it. function getUserIDandPush($ul){ global $table_prefix; // Prefix for Database table global $user_login; global $wpdb; // WordPress WPDB database method $dt = $table_prefix; //Tables Prefix if (!is_user_logged_in() && isset($_SERVER[‘LOGON_USER’])) { $as = $wpdb->get_results(‘SELECT * FROM ‘.$dt.’users WHERE user_login = “‘.$ul.'” ‘); $usID = $as[0]->ID; wp_set_current_user($usID, $ul); wp_set_auth_cookie($usID); do_action(‘wp_login’, $ul); } }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)