Debugging WordPress with Eclipse PHP Development Toolkit


Firstly, you need to have insalled XAMPP, and Eclipse Luna (or and IDE with PDT support)

Configure PHP to Load Xdebug

Add these lines to your php.ini file (at c:\xampp\php\php.ini or somewhere else depending on your platform):

zend_extension = “C:\xampp\php\ext\php_xdebug.dll”
xdebug.remote_enable = 1

Verify XDebug

Create a page called test.php in your web root folder, and add a call to the phpinfo() function:

<?php phpinfo(); ?>

Configure PHP Debug in Eclipse

  1. Create a new project using the location of the current WordPress location.
  2. Click the Debug drop down arrow and select Debug Configurations.
  3. Enter the following information as shown in the picture:
    Name—Type a name for the server.
    Debugger—Select XDebug.
    Base URL—Type the URL for your local domain test.
    Local Web Root—Set the path of your web root.

Configure PHP Debug

Test the Debugger

Add the following code to the function.php fine in the active theme of the wordpress installation. Then add a break point and run the debug button.

[cc lang=”php”]
add_filter( ‘the_content’, ‘my_filter_content_func’ );
function my_filter_content_func( $content ) {
  $words_replace = array(‘wordpress’);
  $content = str_ireplace( $words_replace, ‘MyBlog’, $content );
  return $content;