Skip to main content
Code Tutorial

How to fix “Call undefined function tr_post_type()” or another TypeRocket function helper

When developing a theme using TypeRocket, you might run into the "Call to undefined function" PHP errors. These errors are often due to a theme or plugin making calls to TypeRocket functions before TypeRocket is loaded.

These errors can happen if you install a new version of TypeRocket and something in WordPress goes wrong that prevents TypeRocket from being installed. When this happens and WordPress fails to update TypeRocket, the plugin may become disabled. Once TypeRocket is disabled, you will see the errors.

To fix these undefined function errors, check that TypeRocket has loaded before calling any TypeRocket functions. For example, you can add the following to the very top of your theme's functions.php file to prevent errors with a theme.

// functions.php
if( !defined('TYPEROCKET_PATH') ) {
    return;
}

Once your checks are in place, you can reactivate TypeRocket if it was disabled by error.

Access More TypeRocket

Join our community mailing list and get notified before anyone else. Get videos and more.

By using our website you agree to our Cookie policy.