Title: Using deprecated function add_object_page
Last modified: August 31, 2016

---

# Using deprecated function add_object_page

 *  Resolved [tepelstreel](https://wordpress.org/support/users/tepelstreel/)
 * (@tepelstreel)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/using-deprecated-function-add_object_page/)
 * Hello and thanks for this wonderful plugin!
 * With update to WP 4.5 I get the message in my debug log that ‘add_object_page’
   is deprecated and you should use ‘add_menu_page’ instead.
 * In index.php at line 69 – 72 you have the following code snippet:
 *     ```
       if (!function_exists("add_object_page") || $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["menu_group"])
       		$my_admin_page = add_menu_page($pageTitle, $pluginTitle, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function, $GOTMLS_Full_plugin_logo_URL);
       	else
       		$my_admin_page = add_object_page($pageTitle, $pluginTitle, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function, $GOTMLS_Full_plugin_logo_URL);
       ```
   
 * wich could be changed to:
 *     ```
       if (function_exists("add_menu_page") || $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["menu_group"])
       		$my_admin_page = add_menu_page($pageTitle, $pluginTitle, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function, $GOTMLS_Full_plugin_logo_URL);
       	else
       		$my_admin_page = add_object_page($pageTitle, $pluginTitle, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function, $GOTMLS_Full_plugin_logo_URL);
       ```
   
 * in order to avoid the entry in the debug log. Would that be an option for future
   updates?
 * Cheers,
    Stefan
 * [https://wordpress.org/plugins/gotmls/](https://wordpress.org/plugins/gotmls/)

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

 *  Plugin Author [Eli](https://wordpress.org/support/users/scheeeli/)
 * (@scheeeli)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/using-deprecated-function-add_object_page/#post-7303145)
 * Thanks for reporting this error. I have been trying to recreate this problem 
   but I don’t get that error to come up on my sites that have 4.5
 * I also don’t how the change you suggested would help…
    Current logic: if function
   add_object_page does NOT exist then use add_menu_page else use function add_object_page
 * Your new logic:
    if function add_menu_page DOES exist then use add_menu_page 
   else use function add_object_page
 * I guess that worked for you because add_menu_page DOES exist so it never uses
   add_object_page, which is really what I should change here, I need to completely
   remove add_object_page as an option so that nobody gets that error that you got.
 * I will work that in to my next update and release that fix very soon.
 *  Thread Starter [tepelstreel](https://wordpress.org/support/users/tepelstreel/)
 * (@tepelstreel)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/using-deprecated-function-add_object_page/#post-7303147)
 * It seems to be all about backwards compability. I come with that special site
   where it occured from WP 2.6 or somewhere. My guess is that the function still
   exists in some older core files. But the new function exists as well.
 * I don’t really get the thing either why you couldn’t repoduce the behaviour. 
   Being a plugin author myself, on the other hand I have enough of those cases 
   myself. Someone has an error that I never am able to get. 🙂
 * Just change line 69 to
    `$my_admin_page = add_menu_page($pageTitle, $pluginTitle,
   $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function,
   $GOTMLS_Full_plugin_logo_URL);` would help of course as well, but you would loose
   backwards compability.
 * But thanks very much for your quick answer and for considering the change.
 *  Plugin Author [Eli](https://wordpress.org/support/users/scheeeli/)
 * (@scheeeli)
 * [10 years ago](https://wordpress.org/support/topic/using-deprecated-function-add_object_page/#post-7303273)
 * I just released a new plugin update that fixes this issue. Please upgrade to 
   version 4.16.17 and let me know if that works for you.
 *  Thread Starter [tepelstreel](https://wordpress.org/support/users/tepelstreel/)
 * (@tepelstreel)
 * [10 years ago](https://wordpress.org/support/topic/using-deprecated-function-add_object_page/#post-7303295)
 * Hi there,
 * sorry for a late answer. I was a bit busy the past days. But I did the update
   and everything seems to fine now.
 * Thanks a lot for reacting that fast!
 * Best,
    Stefan

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

The topic ‘Using deprecated function add_object_page’ is closed to new replies.

 * ![](https://ps.w.org/gotmls/assets/icon-256x256.png?rev=1001824)
 * [Anti-Malware Security and Brute-Force Firewall](https://wordpress.org/plugins/gotmls/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gotmls/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gotmls/)
 * [Active Topics](https://wordpress.org/support/plugin/gotmls/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gotmls/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gotmls/reviews/)

## Tags

 * [add_menu_page](https://wordpress.org/support/topic-tag/add_menu_page/)
 * [add_object_page](https://wordpress.org/support/topic-tag/add_object_page/)
 * [deprecated function](https://wordpress.org/support/topic-tag/deprecated-function/)

 * 4 replies
 * 2 participants
 * Last reply from: [tepelstreel](https://wordpress.org/support/users/tepelstreel/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/using-deprecated-function-add_object_page/#post-7303295)
 * Status: resolved