• Resolved Bubba

    (@applebag)


    WordPress 6.4.2
    wpForo 2.2.9

    Fresh wpForo install on a new WP site; when clicking the Appearance -> Menus tab, the page defaults to showing the “wpForo Navigation” menu, and near the bottom you see an error:

    Notice: Trying to get property 'name' of non-object in /home/mysite/public_html/lab/wp-admin/nav-menus.php on line 1215

    Screenshot: https://imgur.com/a/JtMboQj

    Code block at that location:

                                <?php if ( current_theme_supports( 'menus' ) ) : ?>
    
                                    <fieldset class="menu-settings-group menu-theme-locations">
                                        <legend class="menu-settings-group-name howto"><?php _e( 'Display location' ); ?></legend>
                                        <?php
                                        foreach ( $locations as $location => $description ) :
                                            $checked = false;
    
                                            if ( isset( $menu_locations[ $location ] )
                                                    && 0 !== $nav_menu_selected_id
                                                    && $menu_locations[ $location ] === $nav_menu_selected_id
                                            ) {
                                                    $checked = true;
                                            }
                                            ?>
                                            <div class="menu-settings-input checkbox-input">
                                                <input type="checkbox"<?php checked( $checked ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
                                                <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label>
                                                <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] !== $nav_menu_selected_id ) : ?>
                                                    <span class="theme-location-set">
                                                    <?php
                                                        printf(
                                                            /* translators: %s: Menu name. */
                                                            _x( '(Currently set to: %s)', 'menu location' ),
                                                            wp_get_nav_menu_object( $menu_locations[ $location ] )->name
                                                        );
                                                    ?>
                                                    </span>
                                                <?php endif; ?>
                                            </div>
                                        <?php endforeach; ?>
                                    </fieldset>
    
                                <?php endif; ?>

    This line in particular:
    wp_get_nav_menu_object( $menu_locations[ $location ] )->name

    Any ideas?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author forum

    (@blackraz)

    Hi @applebag,

    I can see that the notice is not coming from the wpForo plugin. I have installed the new WordPress on my localhost and tested it. In our end, there is no notice on the Appearance menu. Perhaps, you previously used another WordPress theme, and you had created the menu and linked that menu to the primary menu. After changing the WordPress menu, the old menu comes and does not find its nav menu object. You can report this issue to the developer of the current WordPress theme.

Viewing 1 replies (of 1 total)
  • The topic ‘Notice: Trying to get property ‘name’ of non-object in Menus tab’ is closed to new replies.