Title: Plugin throwing error
Last modified: July 26, 2023

---

# Plugin throwing error

 *  Resolved [silverfernsport](https://wordpress.org/support/users/silverfernsport/)
 * (@silverfernsport)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/plugin-throwing-error-5/)
 * Hey guys, I’ve installed the plugin in a different website and it threw a strange
   error that I haven’t seen before:
 * **Warning**: Attempt to read property “term_id” on int in **/plugins/wpc-ajax-
   search/wpc-ajax-search.php** on line **1128**
 * This is the function inside the plugin that throws the error:
 * > function nav_menu_items( $items, $args ) {
   >                     $saved_menus = self::get_setting( ‘menus’, [] );
   >                     if ( is_array( $saved_menus ) && in_array( $args->menu-
   > >term_id, $saved_menus ) ) {
   >                         $items .= ‘<li class=”menu-item wpcas-menu-item menu-
   > item-type-wpcas”><a href=”#”>’ . self::localization( ‘menu’, esc_html__( ‘Search’,‘
   > wpc-ajax-search’ ) ) . ‘</a></li>’;
   >                     }
   >                     return $items;
   >                 }
 * It seems that the array with the menus is not building property or for some reason
   it can’t read the ID of my menu, the weird thing is that I have this plugin on
   another website and it works perfectly.
 * Any ideas what this could be or how I can work around it, maybe by hard coding
   the header menu ID? Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-throwing-error-5%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [silverfernsport](https://wordpress.org/support/users/silverfernsport/)
 * (@silverfernsport)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/plugin-throwing-error-5/#post-16925758)
 * Hey guys, after some debugging I found out that the object doesn’t contain any
   property named term_id, so I tried removing the “->term_id” access from the function
   and now it’s working well! Here’s the modified function:
 * $saved_menus = self::get_setting( ‘menus’, [] );
 * if ( is_array( $saved_menus ) && in_array( **$args->menu**, $saved_menus ) ) {
 * $items .= ‘<li class=”menu-item wpcas-menu-item menu-item-type-wpcas”><a href
   =”#”>’ . self::localization( ‘menu’,
 *         esc_html__( ‘Search’, ‘wpc-ajax-search’ ) ) . ‘</a></li>’;
 * }
 * return $items;
 * }
    -  This reply was modified 2 years, 10 months ago by [silverfernsport](https://wordpress.org/support/users/silverfernsport/).

Viewing 1 replies (of 1 total)

The topic ‘Plugin throwing error’ is closed to new replies.

 * ![](https://ps.w.org/wpc-ajax-search/assets/icon-128x128.png?rev=2524419)
 * [WPC AJAX Search for WooCommerce](https://wordpress.org/plugins/wpc-ajax-search/)
 * [Support Threads](https://wordpress.org/support/plugin/wpc-ajax-search/)
 * [Active Topics](https://wordpress.org/support/plugin/wpc-ajax-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpc-ajax-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpc-ajax-search/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [silverfernsport](https://wordpress.org/support/users/silverfernsport/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/plugin-throwing-error-5/#post-16925758)
 * Status: resolved