{"id":2301,"date":"2017-06-01T02:51:36","date_gmt":"2017-06-01T02:51:36","guid":{"rendered":"http:\/\/docs.contentviewspro.com\/?p=2301"},"modified":"2023-12-28T07:54:15","modified_gmt":"2023-12-28T07:54:15","password":"","slug":"debug-show-database-query-statement-views","status":"publish","type":"docs","link":"https:\/\/contentviewspro.com\/documentation\/article\/debug-show-database-query-statement-views\/","title":{"rendered":"Debug: show database query"},"content":{"rendered":"<p>This document is used to show database query statement of Views, which helps to troubleshooting the result.<br \/>\nPlease follow following steps: <\/p>\n<ul>\n<li>Add this code to file <strong>functions.php<\/strong> of your active theme:\n<pre style=\"font-size:13px\">\n\/\/ Content Views Pro - debug query\nadd_filter( 'pt_cv_before_output_html', 'cvp_theme_show_debug_param', 100, 1 );\nfunction cvp_theme_show_debug_param( $args ) {\n\tif ( PT_CV_Functions_Pro::user_can_manage_view() ) {\n\t\tglobal $wp;\n\t\t$arr = array();\n\t\tparse_str( $wp-&gt;query_string, $arr );\n\t\t$arr[ 'test123213x' ]\t = 1;\n\t\t$args .= sprintf( '&lt;a class=&quot;btn&quot; href=&quot;%s&quot;&gt;Show Debug Info&lt;\/a&gt;', esc_url(add_query_arg( $arr, home_url( $wp-&gt;request ) )) );\n\t}\n\treturn $args;\n}\nadd_action( 'pt_cv_after_query', 'cvp_theme_show_debug', 99999, 1 );\nfunction cvp_theme_show_debug($args) {\n\tif ( isset( $_GET[ 'test123213x' ] ) &amp;&amp; PT_CV_Functions_Pro::user_can_manage_view() ) {\n\t\tglobal $pt_cv_id;\n\t\techo &quot;&lt;pre&gt;&quot;; var_dump( $pt_cv_id, $args ); echo &quot;&lt;\/pre&gt;&quot;;\n\t}\n}\n<\/pre>\n<\/li>\n<li>Open your page which has issue, click on any <strong>Show Debug Info<\/strong> button. The page will reload.<\/li>\n<\/ul>\n<p>You will see the query statement string show before Views.<br \/>\nPlease copy that string then send us.<\/p>\n<p>Thank you,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8211; debug query add_filter( &#8216;pt_cv_before_output_html&#8217;, &#8216;cvp_theme_show_debug_param&#8217;, 100, 1 ); function cvp_theme_show_debug_param( $args ) { if ( PT_CV_Functions_Pro::user_can_manage_view() ) { global &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/contentviewspro.com\/documentation\/article\/debug-show-database-query-statement-views\/\"> <span class=\"screen-reader-text\">Debug: show database query<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"doc_category":[23],"doc_tag":[21],"class_list":["post-2301","docs","type-docs","status-publish","hentry","doc_category-common-bugs","doc_tag-custom-code"],"year_month":"2026-09","word_count":203,"total_views":"1","reactions":{"happy":"1","normal":"0","sad":"1"},"author_info":{"name":"admin1","author_nicename":"admin1","author_url":"https:\/\/contentviewspro.com\/documentation\/author\/admin1\/"},"doc_category_info":[{"term_name":"Troubleshooting","term_url":"https:\/\/contentviewspro.com\/documentation\/cats\/common-bugs\/"}],"doc_tag_info":[{"term_name":"custom PHP code","term_url":"https:\/\/contentviewspro.com\/documentation\/tags\/custom-code\/"}],"_links":{"self":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/2301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/comments?post=2301"}],"version-history":[{"count":3,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/2301\/revisions"}],"predecessor-version":[{"id":5466,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/docs\/2301\/revisions\/5466"}],"wp:attachment":[{"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/media?parent=2301"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_category?post=2301"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/contentviewspro.com\/documentation\/wp-json\/wp\/v2\/doc_tag?post=2301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}