Warning: Attempt to read property "name" on string

Support MB Term Meta Warning: Attempt to read property "name" on string

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #43983
    BellulBellul
    Participant

    Hi!

    I happened to see the following php warning at the top in the Bricks Builder editor (for a template) - it wasn't there earlier:

    Warning: Attempt to read property "name" on string in /home/xxx/wp-content/plugins/wpcodebox/src/Runner/PhpSnippetRunner.php(17) : eval()'d code on line 142

    Line 142 refers to the following code snippet:

    
    function nod_get_term_name_single( $field_id ) {
    	return rwmb_meta( $field_id )->name;
    }
    

    And the function is referred to in a Bricks template Basic text element ("magazine_no" is the field id/slug):

    
    {echo:nod_get_term_name_single(magazine_no)}
    

    But the code snippet still gives the expected term name (in this case "2023:1") both in the Bricks Builder and in the frontend.

    Why do you think this happens? Bug in Bricks Builder or Meta Box or somewhere else?

    I use Bricks Builder 1.9.2; Meta Box 5.8.2, and Meta Box AIO 1.23.1; WP 6.3.2

    #43989
    PeterPeter
    Moderator

    Hello Bellul,

    What is the field type of the field magazine_no? If it is taxonomy, I don't see that error message on my site. You can try to add the snippet code to a template file in the theme and recheck this issue.

    #43998
    BellulBellul
    Participant

    Thanks! It is taxonomy_advanced.

    #44008
    PeterPeter
    Moderator

    Hello,

    With the taxonomy_advanced field type, I see it works also. Please try to add the snippet code to a template file in the theme and recheck this issue.

    #44013
    BellulBellul
    Participant

    It is already in a template file.

    #44023
    PeterPeter
    Moderator

    Hello,

    Please share your site credentials via this contact form https://metabox.io/contact/
    I will take a look.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.