Title: Uncaught TypeError:
Last modified: August 8, 2023

---

# Uncaught TypeError:

 *  Resolved [Jimmy Lee](https://wordpress.org/support/users/shirtguy72/)
 * (@shirtguy72)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/)
 * Hey Jeff, the following keeps showing up my errorlogs
 * [08-Aug-2023 18:43:18 UTC] PHP Fatal error: Uncaught TypeError: call_user_func_array():
   Argument #1 ($callback) must be a valid callback, function “disable_wp_rest_api_error_custom”
   not found or invalid function name in /home/customer/www/vintageheavymetal.com/
   public_html/wp-includes/class-wp-hook.php:308
   Stack trace: 0 /home/customer/MYSITE/
   public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘REST API restri…’,
   Array) 1 /home/customer/MYSITE/public_html/wp-content/plugins/disable-wp-rest-
   api/disable-wp-rest-api.php(54): apply_filters(‘disable_wp_rest…’, ‘REST API 
   restri…’) 2 /home/customer/MYSITE/public_html/wp-includes/class-wp-hook.php(308):
   disable_wp_rest_api(NULL) 3 /home/customer/MYSITE/public_html/wp-includes/plugin.
   php(205): WP_Hook->apply_filters(NULL, Array) 4 /home/customer/MYSITE/public_html/
   wp-includes/rest-api/class-wp-rest-server.php(189): apply_filters(‘rest_authentica…’,
   NULL) 5 /home/customer/MYSITE/public_html/wp-includes/rest-api/class-wp-rest-
   server.php(439): WP_REST_Server->check_authentication() 6 /home/customer/MYSITE/
   public_html/wp-includes/rest-api.php(410): WP_REST_Server->serve_request(‘/wp/
   v2/users’) 7 /home/customer/MYSITE/public_html/wp-includes/class-wp-hook.php(
   308): rest_api_loaded(Object(WP)) 8 /home/customer/MYSITE/public_html/wp-includes/
   class-wp-hook.php(332): WP_Hook->apply_filters(”, Array) 9 /home/customer/MYSITE/
   public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array) 10 /home/customer/
   MYSITE/public_html/wp-includes/class-wp.php(399): do_action_ref_array(‘parse_request’,
   Array) 11 /home/customer/MYSITE/public_html/wp-includes/class-wp.php(780): WP-
   >parse_request(”) 12 /home/customer/MYSITE/public_html/wp-includes/functions.
   php(1334): WP->main(”) 13 /home/customer/MYSITE/public_html/wp-blog-header.php(
   16): wp() 14 /home/customer/MYSITE/public_html/index.php(17): require(‘/home/
   customer/…’) 15 {main}
 * thrown in /home/customer/MYSITE/public_html/wp-includes/class-wp-hook.php on 
   line 308

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957400)
 * Hey [@shirtguy72](https://wordpress.org/support/users/shirtguy72/), I am not 
   seeing this on default WP running latest version of the plugin. It looks like
   there may be something specific to the site.. if you can provide steps to repeat
   the issue, I’ll investigate and try to resolve asap, thank you.
 *  Thread Starter [Jimmy Lee](https://wordpress.org/support/users/shirtguy72/)
 * (@shirtguy72)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957542)
 * I currently have listed in BBQ Pro [ .php ] in Custom – Request URI
 * All I can think of right now, last BIG thing I changed on the backend.
 * Let me see how things go if I remove the blocking of .php
 *  Thread Starter [Jimmy Lee](https://wordpress.org/support/users/shirtguy72/)
 * (@shirtguy72)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957693)
 * Just tried to test plugin via incognito logged out: MYURL/wp-json/
 * Did not get the “Message” “rest_login_required: REST API restricted to authenticated
   users.”
 * But instead got this:
 * There has been a critical error on this website.
 * Learn more about troubleshooting WordPress.
 * *My IP is whitelisted in BBQ Pro
 *  Thread Starter [Jimmy Lee](https://wordpress.org/support/users/shirtguy72/)
 * (@shirtguy72)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957699)
 * I get the same critical error with blocking .php and without. I’m stumped, haven’t
   a clue.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957705)
 * Nevermind I see you said it was the same error.
    -  This reply was modified 2 years, 10 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957711)
 * I notice in the error it says this:
 * `disable_wp_rest_api_error_custom`
 * Where is that coming from? It’s not something that is included in the plugin.
 *  Thread Starter [Jimmy Lee](https://wordpress.org/support/users/shirtguy72/)
 * (@shirtguy72)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957712)
 * Thanks for taking the time, marked as resolved. Simply going to deactivate, delete
   and use a snippet in functions.php
 * No worries
 *  Thread Starter [Jimmy Lee](https://wordpress.org/support/users/shirtguy72/)
 * (@shirtguy72)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957721)
 * I just caught that too, I was browsing one of your sites and picked up that snippet
   then forgot about it. I had Disable Custom Message in my themes functions.php
   and my install didn’t like it! ALL SET NOW, Plugin working fine! NO ERRORS!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957725)
 * Okay that works.
 * Also I found the source of the `disable_wp_rest_api_error_custom` function, it
   is provided in the plugin FAQs. It is used to customize the error message via
   small code snippet, can be added via theme functions or simple custom plugin.
 * In any case glad you got it sorted, [@shirtguy72](https://wordpress.org/support/users/shirtguy72/).
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957736)
 * Just to add (for anyone using the custom-error snippet): the name of the hook
   used for the custom-error function changed a while back (*probably* the reason
   for the reported error). This is explained in the plugin FAQs and Changelog. 
   The correct code is this:
 *     ```wp-block-code
       function disable_wp_rest_api_error_custom($message) {
   
           return 'Customize your message here.'; // change this to whatever you want
   
       }
       add_filter('disable_wp_rest_api_error', 'disable_wp_rest_api_error_custom');
       ```
   
 * The hook name will not be changed again. And.. if ever in doubt, the plugin FAQs
   always will have the latest/current code snippet.
    -  This reply was modified 2 years, 10 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Uncaught TypeError:’ is closed to new replies.

 * ![](https://ps.w.org/disable-wp-rest-api/assets/icon-256x256.png?rev=1926021)
 * [Disable WP REST API](https://wordpress.org/plugins/disable-wp-rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/disable-wp-rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/disable-wp-rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/disable-wp-rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/disable-wp-rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/disable-wp-rest-api/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/uncaught-typeerror-77/#post-16957736)
 * Status: resolved