Sort posts by custom taxonomy name

One solution would be- $terms = get_terms(‘taxonomy-name’); foreach($terms as $term) { $posts = get_posts(array( ‘post_type’ => ‘custom_post_type_name’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘taxonomy-name’, ‘field’ => ‘slug’, ‘terms’ => $term->slug ) ), ‘numberposts’ => -1 )); foreach($posts as $post) { // do what you want to do with the posts here } }

Order posts by tags count?

As @Robert hue says you can’t do it directly, you need a filter and a CASE in the orderby eg $args1 = array ( ‘orderby’ => ‘tag_count’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘pagination’ => true, ‘posts_per_page’ => ‘1’, // 1 post per page?! ‘meta_key’ => ‘_thumbnail_id’, ‘suppress_filters’ => false, ); function wpse173949_posts_clauses( $pieces, $query … Read more

Show only oldest post by author

To restrict users to just one post, don’t let them create new posts. Just add one wp_editor() instance to their profile. Hook into ‘show_user_profile’ and ‘edit_user_profile’ to show the editor. Hook into ‘personal_options_update’ and ‘edit_user_profile_update’ to save the content to a user meta or a hidden custom post type. Now they don’t have to search … Read more

get data from wp-query, outside the loop & without url change

It sounds like you’re looking for wp_localize_script() which lets you pass data to a script that is already enqueued. It works roughly like this: <?php // assuming your script is already registered wp_enqueue_script( ‘wpse_81817’ ); // Do the array building of terms you plan on doing $wpse_81817_phpdata = array( ‘myKey’ => ‘a value’ ); // … Read more

Query by meta_key and order by meta_value_num return orderby date

The problem in your code is ‘meta_query’ code is write insde array of array $args = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘participant’, ‘order’ => ‘DESC’, ‘meta_key’ => ‘participant_partage_class’, ‘orderby’ => ‘meta_value_num, ‘meta_query’ => array(array( ‘key’ => ‘participant_partage_class’, ‘type’ => ‘SIGNED’, ‘compare’ => ‘>’, )), ‘posts_per_page’ => ‘8’, ‘paged’ => $paged ); $query = new … Read more

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