Set posts_per_page in WP_Query for custom taxonomy

Your WP_Query is formed incorrectly. See WP_Query Taxonomy Parameters. Try this code: <?php $post_type=”page”; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies($post_type); // names (default) foreach( $taxonomies as $taxonomy ) : // Gets every “category” (term) in this taxonomy to get the respective posts $terms = get_terms( $taxonomy ); echo ‘<div … Read more

Modify main loop in taxonomy archive page

You could hijack the $query just before fetching the posts. function wpdev_156674_pre_get_posts( $query ) { if ( $query->is_main_query() && $query->is_tax( ‘region’ ) ) { // Manipulate $query here, for instance like so $query->set( ‘orderby’, ‘meta_value_num’ ); $query->set( ‘meta_key’, ‘event_date’ ); $query->set( ‘order’, ‘DESC’ ); } } add_action( ‘pre_get_posts’, ‘wpdev_156674_pre_get_posts’ ); References: pre_get_posts action hook WP_Query … Read more

Get custom field values of taxonomy terms

Are you using Advanced Custom Fields plugin? If you are, try this if it works: foreach ($terms as $term) { // $cognome_nome will be “P Elena” or “P Andrea” in your case $cognome_nome = get_field(‘cognome_nome’, $term->taxonomy.’_’.$term->term_id); }

Taxonomy , subtaxonomy,child taxonomy of a product woocommerce

Based on this answer, here is my function to get all your terms in an array : function get_term_ancestors($post_id, $taxonomy){ // Declare the array where we are going to store the terms $ancestors = array(); // start from the current term $parent = array_shift(get_the_terms($post_id,$taxonomy)); // climb up the hierarchy until we reach a term with … Read more

Dynamically tax_query terms

If $taxonomy_category is already an array, then: ‘terms’ => array($taxonomy_category) should just be: ‘terms’ => $taxonomy_category where $taxonomy_category is equal to whatever was submitted from your form as $_POST[‘taxonomy_category’] or $_GET[‘taxonomy_category’]

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