{"id":11829,"date":"2015-10-15T11:43:32","date_gmt":"2015-10-15T15:43:32","guid":{"rendered":"http:\/\/webdevstudios.com\/?p=11829"},"modified":"2024-04-15T12:03:32","modified_gmt":"2024-04-15T16:03:32","slug":"debugging-wordpress-tips-snippets","status":"publish","type":"post","link":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/","title":{"rendered":"Debugging WordPress Tips and Snippets"},"content":{"rendered":"<div class=\"intro\">Most developers know of the common <code>WP_DEBUG<\/code> in the config file, but some don&#8217;t know there\u00a0are\u00a0way\u00a0more possibilities with WordPress and PHP in general. In this article, I&#8217;m going to show you some tips and tricks that I use when debugging WordPress plugins and themes.<\/div>\n<div class=\"intro\"><\/div>\n<p><!--more--><\/p>\n<div class=\"intro\"><\/div>\n<h3>The Basics<\/h3>\n<p>Like I said, WP_DEBUG is the common debug flag we use when working with WordPress. You normally see something like this in the wp-config file <code>define( 'WP_DEBUG', 'true' );<\/code> This is what&#8217;s called a constant; it&#8217;s accessible anywhere from within WordPress itself. I, personally, use a more robust debug log, like so:<\/p>\n<div class=\"snippetcpt-wrap\" id=\"snippet-11830\" data-id=\"11830\" data-edit=\"\" data-copy=\"\/wp-json\/wp\/v2\/posts\/11829?snippet=6f92951194&#038;id=11830\" data-fullscreen=\"https:\/\/webdevstudios.com\/code-snippets\/wp-debug-robust-snippet\/?full-screen=1\">\n\t\t\t\t<pre class=\"prettyprint lang-php\" title=\"WP Debug - Robust Snippet\">define( 'WP_DEBUG', true );\nif ( WP_DEBUG ) {\n    define ('JETPACK_DEV_DEBUG', true );\n    define( 'WP_DEBUG_LOG', true );\n    define( 'SCRIPT_DEBUG', true );\n\n    if ( defined( 'DOING_AJAX' ) &amp;&amp; DOING_AJAX || defined( 'DOING_CRON' ) &amp;&amp; DOING_CRON ) {\n        define( 'WP_DEBUG_DISPLAY', false );\n        @ini_set( 'display_errors', 0 );\n    } else {\n        define( 'WP_DEBUG_DISPLAY', true );\n    }\n}<\/pre>\n\t\t\t<\/div>\n<p>I know, it&#8217;s a lot to take in! So let&#8217;s break it down, shall we?<\/p>\n<h4>Jetpack Debug<\/h4>\n<p>One notable constant you&#8217;ll see in this snippet is <code>define( 'JETPACK_DEV_DEBUG', true );<\/code> This constant sets Jetpack into debug mode in your development environment. If your project doesn&#8217;t use Jetpack, you may not need this one, but Jetpack is a daily thing so I always have it.<\/p>\n<h4>Logging<\/h4>\n<p>The next is <code>WP_DEBUG_LOG<\/code>, this is an absolute MUST if you are debugging in WordPress. What this does is provide a debug.log file in your<code> \/wp-content\/<\/code> directory for you to read. What I like to do, since I have more than one monitor, is to open a terminal and dedicate one monitor to the debug file. To do this, if you&#8217;re not familiar, you can tail the file like so: <code>tail -f wp-content\/debug.log<\/code> this will stream the file to your terminal. Every time a new error shows up, you&#8217;ll see it.<\/p>\n<p>If you&#8217;re new to the command line, and have a Mac, a simple process you can follow is:<\/p>\n<ul>\n<li>Type <code>tail -f<\/code>\u00a0in your terminal<\/li>\n<li>Navigate to the wp-content directory of the project you&#8217;re working on. If there is no debug.log file there, simply create it.<\/li>\n<li>Once the debug.log file exists, drag it to your terminal window to right after the <code>tail -f<\/code>\u00a0you typed. This will output the full file path location in terminal<\/li>\n<li>Hit <code>enter<\/code>. Once you do that, you&#8217;ll see when items get added to the log on the fly.<\/li>\n<li>To stop the tail output, hit <code>ctrl + c<\/code>\u00a0on your keyboard<\/li>\n<\/ul>\n<h4>Script Debugging<\/h4>\n<p>I don&#8217;t see this a lot, but it&#8217;s VERY useful if you&#8217;re working with JavaScript, as well as forcing WordPress and\/or your plugins\/themes to load non-minified files. Another great thing you can do is use\u00a0script debug to pass to your JavaScript&#8211;so you can keep your debug code inside your script without having to re-save it. This is especially useful with projects that use grunt and require you to re-compile your scripts.\u00a0Here&#8217;s the snippet:<\/p>\n<div class=\"snippetcpt-wrap\" id=\"snippet-11831\" data-id=\"11831\" data-edit=\"\" data-copy=\"\/wp-json\/wp\/v2\/posts\/11829?snippet=6f92951194&#038;id=11831\" data-fullscreen=\"https:\/\/webdevstudios.com\/code-snippets\/wp-debug-using-script-debug\/?full-screen=1\">\n\t\t\t\t<pre class=\"prettyprint linenums lang-php\" title=\"WP Debug - Using Script Debug\">&lt;?php\n\n\/\/ Using Script Debug to load non-minified scripts\n$min = defined( 'SCRIPT_DEBUG' ) &amp;&amp; SCRIPT_DEBUG ? '' : '.min';\nwp_enqueue_script( 'my_awesome_script', &quot;my_inc_dir\/javascript_file{$min}.js&quot;, array( 'jquery' ), '0.1.0', true );\n\n\/\/ Using script debug to log data in a javascript file\nwp_localize_script( 'my_awesome_script', 'mas_obj', array( \n    \/\/ Set to true if debug is enabled, false otherwise\n    'is_debug' =&gt; defined( 'SCRIPT_DEBUG' ) &amp;&amp; SCRIPT_DEBUG ? true : false,\n) );\n\n?&gt;\n\n&lt;script type=&quot;text\/javascript&quot;&gt;\n\n    \/\/ Try and grab our object, if not make one.\n    var our_script_l10n = window.mas_obj || {};\n\n    \/\/ Check if debug is available\/true\n    if ( our_script_l10n.is_debug ) {\n        \/\/ We have debug on for our script, so alert the user.\n        alert( 'Debug Works' );\n    }\n\n&lt;\/script&gt; <\/pre>\n\t\t\t<\/div>\n<p>A\u00a0good way of handling minimized vs expanded scripts is to take a look at the first section when you queue\u00a0it up. Most of the time, when developing, you want to make 100% sure you can debug your scripts, and if your browser throws an error on a minimized script&#8230;well, we all know how much of a pain that is.<\/p>\n<p>Next up is script localization. Looking at lines 8-11, you can see that I&#8217;m passing an is_debug variable to the script we just queued up. This will allow you (as in the lower section) to check against that and debug ONLY when that&#8217;s available. By doing this, and given that most production servers don&#8217;t use the debug constant, you\u00a0will prevent end-users from seeing your debug output on the production site.<\/p>\n<h4>To Display or Not to Display?<\/h4>\n<p>That is the question, right? This all comes down to preference really. In the\u00a0first section in the debug snippet (the first one on the post) you&#8217;ll see a check for <code>defined( 'DOING_AJAX' )<\/code> as well as <code>defined( 'DOING_CRON' ).\u00a0<\/code>This is to make sure that if an AJAX\u00a0call or cron job is running, we don&#8217;t accidentally drop debug data into these responses. The section you want to pay attention to is in the else portion of the conditional. This is where you make your decision&#8211;pretty simple though! Just true or false.<\/p>\n<p>Since I stream the debug log on my second monitor, I set this to false, but for the purpose of this blog post, I&#8217;ve set it to true&#8211;just in case you decided to copy\/paste the snippet without reading the actual information attached.<\/p>\n<h3>Advanced Debugging<\/h3>\n<p>I&#8217;m not sure this is really considered advanced debugging, but it does require a knowledge of built-in <a href=\"http:\/\/php.net\/manual\/en\/language.constants.predefined.php\">PHP Magic Constants<\/a> to grasp, as well as the <code>error_log()<\/code> function that&#8217;s built into PHP. Throughout your development career, you will need to debug an entire class, large function, or a whole file, usually because there&#8217;s no data being output to the debug log.<\/p>\n<p>This is definitely where these magic constants come in handy. Magic constants are great\u00a0for more than\u00a0just debugging, but my focus here is\u00a0how I use these in a debugging environment. Here are a few examples that should get you on the right track:<\/p>\n<div class=\"snippetcpt-wrap\" id=\"snippet-11832\" data-id=\"11832\" data-edit=\"\" data-copy=\"\/wp-json\/wp\/v2\/posts\/11829?snippet=6f92951194&#038;id=11832\" data-fullscreen=\"https:\/\/webdevstudios.com\/code-snippets\/wp-debug-magic-constants\/?full-screen=1\">\n\t\t\t\t<pre class=\"prettyprint linenums lang-php\" title=\"WP Debug - Magic Constants\">&lt;?php\n\nclass My_Class {\n    public function my_func() {\n        \/\/ We can error log our data here.\n        error_log( __LINE__ ); \/\/ outputs 6\n\n        \/\/ Or we can also log which method we're in\n        error_log( __METHOD__ ); \/\/ outputs My_Class::my_func\n    }\n}\n\nfunction my_function() {\n    \/\/ With functions, you can also log their function name\n    error_log( __FUNCTION__ ); \/\/ outputs my_function\n}\n\nfunction log_this(){\n    \/\/ You can also combine them, here is a basic example\n    error_log( sprintf( '%s - %s::%d', date( 'F j Y', time() ), __FUNCTION__, __LINE__ ) );\n    \/\/ Will output something like August 1, 2015 - log_this::21\n}<\/pre>\n\t\t\t<\/div>\n<p>Here&#8217;s a quick rundown for those of you who don&#8217;t want to click through the link:<\/p>\n<ul>\n<li>__FUNCTION__ &#8211; Returns a string, containing the name of the function the constant is used within.<\/li>\n<li>__METHOD__ &#8211; Usable only within classes, this returns a string containing the method &amp; class\u00a0name the constant is used within.<\/li>\n<li>__CLASS__ &#8211; Though not shown in the example, this will return a string containing the class name the constant is in.<\/li>\n<li>__LINE__ &#8211; Last but not least is LINE (possibly my most used)&#8211;it returns the line number that it is currently on.<\/li>\n<\/ul>\n<p>Line for me, is the most common, when debugging larger files, I tend to just spam <code>error_log( __LINE__ )<\/code> throughout and see which ones return data and which ones are skipped. This is doubly helpful with huge files with a lot of conditionals. Though I caution the use of <code>__LINE__<\/code> within loops, as you will undoubtedly get confused. You will also want to make sure you remove the error logs if you didn&#8217;t put them in a debug conditional check, as stated in the previous section.<\/p>\n<h3>Conclusion<\/h3>\n<p>When writing themes &amp; plugins, it is your responsibility to make sure your code is clean and not junking up the debug log or your PHP <code>error_log<\/code> file. There&#8217;s nothing more depressing to a developer than getting flooded with messages because the previous developer didn&#8217;t use debugging at all. Your whole team should be using debugging&#8211;developers and designers alike. The more eyes you have on a site, the more chances you&#8217;ll get to\u00a0find issues&#8230;unless you write perfect code, of course.<\/p>\n<p>No one is perfect! We all break things, but without looking at our debug logs, we may never see it.<\/p>\n<p>Have any questions or insight about debugging? Throw it in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most developers know of the common WP_DEBUG in the config file, but some don&#8217;t know there\u00a0are\u00a0way\u00a0more possibilities with WordPress and PHP in general. In this article, I&#8217;m going to show you some tips and tricks that I use when debugging WordPress plugins and themes.<\/p>\n","protected":false},"author":26,"featured_media":11870,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[357,142],"tags":[8,478,679],"coauthors":[2798],"class_list":["post-11829","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debugging","category-wordpress","tag-wordpress","tag-wordpress-tutorial","tag-wp_debug"],"acf":{"blog_hero_image":null},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Debugging WordPress Tips and Snippets - WebDevStudios<\/title>\n<meta name=\"description\" content=\"Jay offers some tips for debugging WordPress. No one&#039;s code is perfect, but with these tips, you can make sure it&#039;s pretty close.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Debugging WordPress Tips and Snippets\" \/>\n<meta property=\"og:description\" content=\"Jay offers some tips for debugging WordPress. No one&#039;s code is perfect, but with these tips, you can make sure it&#039;s pretty close.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/\" \/>\n<meta property=\"og:site_name\" content=\"WebDevStudios\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/webdevstudios\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/therealjaywood\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-15T15:43:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-15T16:03:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"851\" \/>\n\t<meta property=\"og:image:height\" content=\"315\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jay Wood\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@plugish\" \/>\n<meta name=\"twitter:site\" content=\"@webdevstudios\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jay Wood\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/\"},\"author\":{\"name\":\"Jay Wood\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/person\\\/9f638478f25bda2a875a53cdfc473be8\"},\"headline\":\"Debugging WordPress Tips and Snippets\",\"datePublished\":\"2015-10-15T15:43:32+00:00\",\"dateModified\":\"2024-04-15T16:03:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/\"},\"wordCount\":1145,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/debugging-wordpress.jpg\",\"keywords\":[\"WordPress\",\"WordPress tutorial\",\"WP_DEBUG\"],\"articleSection\":[\"Debugging\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/\",\"name\":\"Debugging WordPress Tips and Snippets - WebDevStudios\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/debugging-wordpress.jpg\",\"datePublished\":\"2015-10-15T15:43:32+00:00\",\"dateModified\":\"2024-04-15T16:03:32+00:00\",\"description\":\"Jay offers some tips for debugging WordPress. No one's code is perfect, but with these tips, you can make sure it's pretty close.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#primaryimage\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/debugging-wordpress.jpg\",\"contentUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2015\\\/10\\\/debugging-wordpress.jpg\",\"width\":851,\"height\":315},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/2015\\\/10\\\/15\\\/debugging-wordpress-tips-snippets\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/webdevstudios.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Debugging WordPress Tips and Snippets\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#website\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/\",\"name\":\"WebDevStudios\",\"description\":\"WordPress Design and Development Agency\",\"publisher\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/webdevstudios.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#organization\",\"name\":\"WebDevStudios\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/wds-amp-logo.png\",\"contentUrl\":\"https:\\\/\\\/webdevstudios.com\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/wds-amp-logo.png\",\"width\":173,\"height\":60,\"caption\":\"WebDevStudios\"},\"image\":{\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"http:\\\/\\\/facebook.com\\\/webdevstudios\",\"https:\\\/\\\/x.com\\\/webdevstudios\",\"http:\\\/\\\/instagram.com\\\/webdevstudios\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/webdevstudios-llc-\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/webdevstudios.com\\\/#\\\/schema\\\/person\\\/9f638478f25bda2a875a53cdfc473be8\",\"name\":\"Jay Wood\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a5f8cce12a21f6e8eb6cc99bd34c885cff5823bdd0cd8f668fed7eb701087b25?s=96&d=mm&r=g430ab42173e114823f1b9be6d2cafc6e\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a5f8cce12a21f6e8eb6cc99bd34c885cff5823bdd0cd8f668fed7eb701087b25?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a5f8cce12a21f6e8eb6cc99bd34c885cff5823bdd0cd8f668fed7eb701087b25?s=96&d=mm&r=g\",\"caption\":\"Jay Wood\"},\"sameAs\":[\"http:\\\/\\\/plugish.com\",\"https:\\\/\\\/www.facebook.com\\\/therealjaywood\",\"https:\\\/\\\/x.com\\\/plugish\"],\"url\":\"https:\\\/\\\/webdevstudios.com\\\/author\\\/jay\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Debugging WordPress Tips and Snippets - WebDevStudios","description":"Jay offers some tips for debugging WordPress. No one's code is perfect, but with these tips, you can make sure it's pretty close.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/","og_locale":"en_US","og_type":"article","og_title":"Debugging WordPress Tips and Snippets","og_description":"Jay offers some tips for debugging WordPress. No one's code is perfect, but with these tips, you can make sure it's pretty close.","og_url":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/","og_site_name":"WebDevStudios","article_publisher":"http:\/\/facebook.com\/webdevstudios","article_author":"https:\/\/www.facebook.com\/therealjaywood","article_published_time":"2015-10-15T15:43:32+00:00","article_modified_time":"2024-04-15T16:03:32+00:00","og_image":[{"width":851,"height":315,"url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg","type":"image\/jpeg"}],"author":"Jay Wood","twitter_card":"summary_large_image","twitter_creator":"@plugish","twitter_site":"@webdevstudios","twitter_misc":{"Written by":"Jay Wood","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#article","isPartOf":{"@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/"},"author":{"name":"Jay Wood","@id":"https:\/\/webdevstudios.com\/#\/schema\/person\/9f638478f25bda2a875a53cdfc473be8"},"headline":"Debugging WordPress Tips and Snippets","datePublished":"2015-10-15T15:43:32+00:00","dateModified":"2024-04-15T16:03:32+00:00","mainEntityOfPage":{"@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/"},"wordCount":1145,"commentCount":1,"publisher":{"@id":"https:\/\/webdevstudios.com\/#organization"},"image":{"@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#primaryimage"},"thumbnailUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg","keywords":["WordPress","WordPress tutorial","WP_DEBUG"],"articleSection":["Debugging","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/","url":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/","name":"Debugging WordPress Tips and Snippets - WebDevStudios","isPartOf":{"@id":"https:\/\/webdevstudios.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#primaryimage"},"image":{"@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#primaryimage"},"thumbnailUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg","datePublished":"2015-10-15T15:43:32+00:00","dateModified":"2024-04-15T16:03:32+00:00","description":"Jay offers some tips for debugging WordPress. No one's code is perfect, but with these tips, you can make sure it's pretty close.","breadcrumb":{"@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#primaryimage","url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg","contentUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg","width":851,"height":315},{"@type":"BreadcrumbList","@id":"https:\/\/webdevstudios.com\/2015\/10\/15\/debugging-wordpress-tips-snippets\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webdevstudios.com\/"},{"@type":"ListItem","position":2,"name":"Debugging WordPress Tips and Snippets"}]},{"@type":"WebSite","@id":"https:\/\/webdevstudios.com\/#website","url":"https:\/\/webdevstudios.com\/","name":"WebDevStudios","description":"WordPress Design and Development Agency","publisher":{"@id":"https:\/\/webdevstudios.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webdevstudios.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webdevstudios.com\/#organization","name":"WebDevStudios","url":"https:\/\/webdevstudios.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webdevstudios.com\/#\/schema\/logo\/image\/","url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2019\/07\/wds-amp-logo.png","contentUrl":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2019\/07\/wds-amp-logo.png","width":173,"height":60,"caption":"WebDevStudios"},"image":{"@id":"https:\/\/webdevstudios.com\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/facebook.com\/webdevstudios","https:\/\/x.com\/webdevstudios","http:\/\/instagram.com\/webdevstudios","https:\/\/www.linkedin.com\/company\/webdevstudios-llc-\/"]},{"@type":"Person","@id":"https:\/\/webdevstudios.com\/#\/schema\/person\/9f638478f25bda2a875a53cdfc473be8","name":"Jay Wood","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a5f8cce12a21f6e8eb6cc99bd34c885cff5823bdd0cd8f668fed7eb701087b25?s=96&d=mm&r=g430ab42173e114823f1b9be6d2cafc6e","url":"https:\/\/secure.gravatar.com\/avatar\/a5f8cce12a21f6e8eb6cc99bd34c885cff5823bdd0cd8f668fed7eb701087b25?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a5f8cce12a21f6e8eb6cc99bd34c885cff5823bdd0cd8f668fed7eb701087b25?s=96&d=mm&r=g","caption":"Jay Wood"},"sameAs":["http:\/\/plugish.com","https:\/\/www.facebook.com\/therealjaywood","https:\/\/x.com\/plugish"],"url":"https:\/\/webdevstudios.com\/author\/jay\/"}]}},"jetpack_featured_media_url":"https:\/\/webdevstudios.com\/wp-content\/uploads\/2015\/10\/debugging-wordpress.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3WX6u-34N","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/posts\/11829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/comments?post=11829"}],"version-history":[{"count":0,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/posts\/11829\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/media\/11870"}],"wp:attachment":[{"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/media?parent=11829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/categories?post=11829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/tags?post=11829"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/webdevstudios.com\/wp-json\/wp\/v2\/coauthors?post=11829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}