Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Using r-debug.php

Since the video has been made (https://teamtreehouse.com/library/wordpress-hooks-actions-and-filters/an-overview-of-hooks-in-wordpress/working-with-wpfilter), the provided functions from Rars.net have been updated and appended in r-debug.php. And I have tried to update accordingly.

functions.php:

<?php 

require_once('examples/list_hooks.php');

?>

list_hooks.php:

<?php

    require_once( 'r-debug.php' );
    list_hooks();

?>

The site return: "Fatal error: Call to undefined function list_hooks() in /Applications/MAMP/htdocs/hooks/wp-content/themes/wp-hooks/examples/list_hooks.php on line 4"

Although r-debug.php provide this function on line 105:

<?php
    static function list_hooks( $filter = false )
?>

I know that it has been mentioned that we shouldn't follow this video along. But I'm anyway curious about why the error message appear anyway.

Thank you!

1 Answer

Jon Gosling
Jon Gosling
9,507 Points

Hi Alexander,

Did you instantiate the R_Debug() class? If not, in your list_hooks.php try the following:-

<?php

    require_once( 'r-debug.php' );
    $r_debug_object = new R_Debug();
    $r_debug_object->list_hooks();

?>

Hope this helps, Jon