How to display mysql query that ran in wp_query wordpress?

$args = array(
‘post_type’ => ‘auto’,
‘posts_per_page’ => -1,
‘meta_query’ => $meta_query

$mquery = new WP_Query($args);

echo $mquery->request;

$mquery->request will return the sql query formed.



Is used to bring the opened window to the top of the current page , even if you click back an parent page an again trying to open the same opened page.

In Firefox will open the page to top but when you back and forth from previous page it will hide in the background for solving this we can use .focus() to the window open method.


wp_nav_menu() with custom html and dynamic class before each menu

This is my Menu Html format :

Code to display Menu in the page dynamically using the above html structure:

$menuParameters = array(
‘theme_location’ => ‘top’,
‘menu’ => ‘Top Menu’,
‘container’ => false,
‘echo’ => false,
‘items_wrap’ => ‘%3$s’,
‘link_before’ => ”,
‘link_after’ => ”,
‘depth’ => 0,
$menu = strip_tags(wp_nav_menu($menuParameters ), ‘<a><span>’ );
$find = array(‘<a’);
$replace = array(‘<a class=”list-group-item list-group-item-success” data-parent=”#MainMenu”‘);
echo str_replace( $find, $replace, $menu );

Hook to use dynamic class values before each span element in the menu “nav_menu_link_attributes” :


function add_specific_menu_location_atts( $atts, $item, $args ) {
if( $args->theme_location == ‘dashboard’ ) {
foreach($item as $key => $value) {

if($key == ‘title’) {

if($value == ‘My Account’)
$catIcon = ‘fa-user’;

$catIcon = ‘fa-file-text’;
foreach($args as $key => $value) {
if($key == ‘link_before’) {
$args->$key = ‘<span class=”fa ‘.$catIcon.’ “></span>’;


// add the desired attributes:
$atts[‘class’] = ‘btn btn-primary btn-lg’;
return $atts;
add_filter( ‘nav_menu_link_attributes’, ‘add_specific_menu_location_atts’, 10, 3 );


The Elephant Rope: 

As a man was passing the elephants, he suddenly stopped, confused by the fact
that these huge creatures were being held by only a small rope tied to their front leg.
No chains, no cages. It was obvious that the elephants could, at anytime, break away
from their bonds but for some reason, they did not. He saw a trainer nearby and asked
why these animals just stood there and made no attempt to get away.
“Well,” trainer said, “When they are very young and much smaller we use the
same size rope to tie them and, at that age, it’s enough to hold them. As they grow up,
they are conditioned to believe they cannot break away. They believe the rope can still
hold them, so they never try to break free.”
Like the elephants, how many of us go through life hanging onto a belief that
we cannot do something, simply because we failed at it once before? Failure is part of
learning; we should never give up the struggle in life. The man was amazed. These
animals could at any time break free from their bonds, but, because they believed they
couldn’t, they were stuck right where they were.
Moral: “What we think, we become…”