Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Menu Pluc Width and Height error

  • When I activate these 3 options in the wp-config file

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', true );

    And with the active MENU+ feature

    I get this error at the top of my website.

    Notice : Undefined index: width in
    /home/cp04u/public_html/domain.com/wp-content/plugins/gp-premium/menu-plus/functions/generate-menu-plus.php
    on line
    2200

    Notice : Undefined index: height in
    /home/cp04u/public_html/domain.com/wp-content/plugins/gp-premium/menu-plus/functions/generate-menu-plus.php
    on line
    2201

  • Hi there,

    it’s because you are using an SVG logo and it has incorrect width and height attributes in the SVG code.

    Here’s a screenshot of your SVG code, both px in the highlighted area need to be removed from the code.
    2023-05-02_12-30-20.png

    Let me know if this helps!

  • Hello.
    Thanks for your return.

    Can you explain better:

    01 Why do you say the values ​​in the SVG code are wrong?

    02 What would be the correct values?

    03 And how do you suggest that these values ​​be changed?

    Have a great day.

  • In the alert, it says that the error is in the plus menu code: “generate-menu-plus.php”

    Wouldn’t the reason for the error be the fact that the menu plus code wasn’t prepared to handle SVG files?

    Because all the svg files I create, I define a size for them.
    I need to set a size at export time.
    How am I going to create an svg file without defining its dimensions?

    it doesn’t make sense to me.

  • Hello Delai,

    Just remove px. Leave the values.

  • Hey,
    I edited de SVG image using notepad and remove de px, this work perfectly.

    But see.

    When i export image from coreldraw, i can’t see any option to remove this “px” from svg code, see:
    https://imgur.com/a/f04YF6T

    Don’t you think Generatepress should handle svg images to avoid these errors?

    Since the px is generated by coreldraw itself at the time of export?

    Please note that this does not occur with the default WordPress theme. It’s something that only affects Generatepress

  • Usually, SVGs now don’t have px in the code. Example: https://icons.getbootstrap.com/icons/arrow-down-square/

    I tested your SVG on my test site and I’m not encountering the issue with px in the code.

    Can you try installing the Safe SVG plugin and reuploading your SVGs?: https://wordpress.org/plugins/safe-svg/

  • You didn’t find it because, as I said, I removed the px via notepad, and re-uploaded the svg without px.

    I already use the safe svg plugin by 10up to allow the use of svg on websites.

  • To clarify, is it the current logo you have? If so, I re-added px manually.

  • Yes.

    The logo you see now is the same svg logo, i only remove the px using the notepad and re-upload on wordpress.

  • Hi there,

    Wouldn’t the reason for the error be the fact that the menu plus code wasn’t prepared to handle SVG files?

    its actually the limitations in WordPress not supporting SVG by default.

    GP uses core WordPress functions to handle the site logos.
    One of those functions is this: wp_get_attachment_metadata

    https://developer.wordpress.org/reference/functions/wp_get_attachment_metadata/

    And it expects the width and height of the attachment to be an integer. Which is standard for a img attachment.

    If CorelDraw insists on adding px to those attributes then run the SVG through this optimizer:

    https://jakearchibald.github.io/svgomg/

    That should remove them and clean up the SVG

  • Thanks David, i will talk to safe svg developer and talk about this.

    Have a good day.

  • You’re welcome

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