Debug: show database query

This document is used to show database query statement of Views, which helps to troubleshooting the result.
Please follow following steps:

  • Add this code to file functions.php of your active theme:
    // Content Views Pro - debug query
    add_filter( 'pt_cv_before_output_html', 'cvp_theme_show_debug_param', 100, 1 );
    function cvp_theme_show_debug_param( $args ) {
    	if ( PT_CV_Functions_Pro::user_can_manage_view() ) {
    		global $wp;
    		$arr = array();
    		parse_str( $wp->query_string, $arr );
    		$arr[ 'test123213x' ]	 = 1;
    		$args .= sprintf( '<a class="btn" href="%s">Show Debug Info</a>', esc_url(add_query_arg( $arr, home_url( $wp->request ) )) );
    	}
    	return $args;
    }
    add_action( 'pt_cv_after_query', 'cvp_theme_show_debug', 99999, 1 );
    function cvp_theme_show_debug($args) {
    	if ( isset( $_GET[ 'test123213x' ] ) && PT_CV_Functions_Pro::user_can_manage_view() ) {
    		global $pt_cv_id;
    		echo "<pre>"; var_dump( $pt_cv_id, $args ); echo "</pre>";
    	}
    }
    
  • Open your page which has issue, click on any Show Debug Info button. The page will reload.

You will see the query statement string show before Views.
Please copy that string then send us.

Thank you,

Scroll to Top