How can I display a query in a page?

You can use the $wpdb object // Print last SQL query string $wpdb->last_query or: <?php if (current_user_can(‘administrator’)){ global $wpdb; echo “<pre>”; print_r($wpdb->queries); echo “</pre>”; }//Lists all the queries executed on your page ?> You might have to set define(‘SAVEQUERIES’, true); in wp-config.php

WP_Query don’t working with fixed post_id and term_taxonomy

The behavior you described is how WordPress works by design, if you provide a ‘p’ parameter, then ‘tax_query’ is ignored, see inside this else statment in wp-includes/query.php:L1643, this is where ‘tax_query’ is processed and added to the SQL statement, and this only happens if this if (line 1634) is skipped.

How to make a shortcode for my WP_Query Loop? [duplicate]

I´m doing this since last year and i´m getting the shortcodes working: function my_code() { ob_start(); get_template_part(‘loop_logos’); return ob_get_clean(); } add_shortcode( ‘logos’, ‘my_code’ ); where get_template_part loads the file loop_logos.php and logos is the name shortcode [logos]. HINT When I started to do this I used to name all equal to avoid mistakes, Ex: function … Read more

Query_post 5 post first / last of post_id

Here I’ve written a function for you. It will return you an array of posts. You need to use is as wpse_243452_get_posts_by_ids( 50, 5, false ) if you need to get next X posts then just pass the second parameter as the integer number how many posts you need and then pass true. If you … Read more