• Resolved Jos Velasco

    (@josvelasco)


    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 3 replies - 1 through 3 (of 3 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

    Plugin Support David Smith

    (@get_dave)

    @josvelasco As promised here is a video which shows a work around to allow you to access those Nav block inner items. Unfortunately it does require some technical work but hopefully it’s manageable?

    I also explain in the video why we’ve not been able to offer editing of the items within WordPress yet. Hopefully this provides some good background and context.

    I’m hopeful that a better solution will be available in a future WordPress release.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Copy the content of a navigation block’ is closed to new replies.