Title: PHP Notices
Last modified: May 25, 2018

---

# PHP Notices

 *  Resolved [dhunink](https://wordpress.org/support/users/dhunink/)
 * (@dhunink)
 * [8 years ago](https://wordpress.org/support/topic/php-notices-89/)
 * Hi,
 * having WP Debug set to True and PHP Warnings enabled, the plugin turns out to
   generate a warning. Hopefully that’s one with an easy fix.
 * The issue origins from line 124 on the file /includes/class-shortcode-in-menus.
   php.
    It looks this line is testing for a property of the $item object that’s
   not present.

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

 *  Plugin Author [Gagan Deep Singh](https://wordpress.org/support/users/gagan0123/)
 * (@gagan0123)
 * [8 years ago](https://wordpress.org/support/topic/php-notices-89/#post-10325751)
 * [@dhunink](https://wordpress.org/support/users/dhunink/)
 * Thank you for reporting the issue.
 * Can you provide some more detail about which theme is being used and which WordPress
   version are you using?
 * Also, can you list other plugins that are being used on the sites for menus?
 * On line 124, a function is overriding the default behaviour of menus via filter
   and as per documentation, the filter `walker_nav_menu_start_el` should be providing
   $item object.
    [https://developer.wordpress.org/reference/hooks/walker_nav_menu_start_el/](https://developer.wordpress.org/reference/hooks/walker_nav_menu_start_el/)
 * If some other plugin is generating menus, without adhering to WordPress’ standard,
   and not providing that object, then it would be causing the warning.
 * In the meantime I’ll add an additional check in the plugin to see if the $item
   object has certain properties or not, to rectify this issue.
 *  Thread Starter [dhunink](https://wordpress.org/support/users/dhunink/)
 * (@dhunink)
 * [8 years ago](https://wordpress.org/support/topic/php-notices-89/#post-10326438)
 * Hi!
    I’ve done some more debugging and nailed it down to specific situation where
   there’s no menu set for a menu location. Happens a lot when the plugin is installed
   on a new installation where the user did not yet created menu’s and/or assigned
   these menu’s to a menu location. In that case the $item object is indeed empty,
   which is normal behavior. But the code always assumes the $item object consists
   of something. My suggestion: add a simple check in the function that checks if
   the $item object has the desired content. If not, the function does not need 
   to continue.
 *  [hbwarper](https://wordpress.org/support/users/hbwarper/)
 * (@hbwarper)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/php-notices-89/#post-10851148)
 * Replacing :
    `if ( 'gs_sim' !== $item->object ) {` with: `if (!isset($item->object)
   || $item->object !== 'gs_sim'){`
 * and replacing
    `if ('FULL HTML OUTPUT' === $item->post_title ) {` with `if (isset(
   $item->post_title) && 'FULL HTML OUTPUT' === $item->post_title ) {`
 * In the file: wp-content/plugins/shortcode-in-menus/includes/class-shortcode-in-
   menus.php
    Stops this plugin from filling the log with thousands of error lines
   per day.
 *  Thread Starter [dhunink](https://wordpress.org/support/users/dhunink/)
 * (@dhunink)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/php-notices-89/#post-10853500)
 * [@gagan0123](https://wordpress.org/support/users/gagan0123/) are you looking 
   to fix this, following the suggestion made by [@hbwarper](https://wordpress.org/support/users/hbwarper/)?
 *  Plugin Author [Gagan Deep Singh](https://wordpress.org/support/users/gagan0123/)
 * (@gagan0123)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/php-notices-89/#post-10853523)
 * [@dhunink](https://wordpress.org/support/users/dhunink/)
 * Yes, I’ll be adding this patch and will provide an update by tomorrow.
 * [@hbwarper](https://wordpress.org/support/users/hbwarper/)
 * Thanks for the patch 🙂 , would it be okay if I use your name in the list of 
   contributors for the plugin?

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

The topic ‘PHP Notices’ is closed to new replies.

 * ![](https://ps.w.org/shortcode-in-menus/assets/icon-128x128.png?rev=1016813)
 * [Shortcode in Menus](https://wordpress.org/plugins/shortcode-in-menus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcode-in-menus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcode-in-menus/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcode-in-menus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcode-in-menus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 3 participants
 * Last reply from: [Gagan Deep Singh](https://wordpress.org/support/users/gagan0123/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/php-notices-89/#post-10853523)
 * Status: resolved