Support » Plugin: Gutenberg » Copy the content of a navigation block

  • Hi all, do you know if there is a way to edit a navigation block content using the code view?

    When I edit a menu using the code view I see only the reference.
    <!-- wp:navigation {"ref":2455} /-->

    If I try to edit it from /wp-admin/edit.php?post_type=wp_navigation it doesn’t let me edit the content of the block, just the title.

    I would like to insert it in a child theme header to use it on a network of sites.

    Even better, I’d like to call it from the header and specify the site ID to grab it from. But for now I’d be happy just to see the content of the block instead of the reference and copy and paste it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support David Smith

    (@get_dave)

    Hi @josvelasco

    I worked on this block so I have some good insight here.

    It was actually a deliberate decision to hide the content editor on the Navigation posts edit view. That might seem like an odd decision but unfortunately the Navigation Item blocks (which is what the content would show) has some very specific requirements in order to work properly in the editor. The main one is that all Nav items must be children of a parent Navigation block. As the Navigation block itself isn’t saved to the Navigation Post content it wouldn’t be present the thus the Nav items wouldn’t work.

    We’re aware of this problem and are working on a solution which we’ll land in the Gutenberg Plugin.

    Until then the best solution is to try and use a database viewing tool such as PhpMyAdmin to access post_content field of the wp_navigation post.

    Find the posts table. Filter by the wp_navigation post type. Then find the Post with the ID that matches your Navigation Post. The post_content field of that post contains the Navigation block data.

    I appreciate this might be tricky if you are not experienced in using a database tool. I’ll try and post a YouTube video talking you through this in the near future and I’ll drop a link here.

    In the meantime, know that we are working on a solution to this problem and appreciate your patience.

    Kindest,

    David

    Plugin Support David Smith

    (@get_dave)

    Here is an Issue I created to track these requirement.

    https://github.com/WordPress/gutenberg/issues/37950

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