Support » Fixing WordPress » 5.6 core-embed/youtube is now core/embed

  • mrerrand


    Hey everyone!
    Just notice this odd issue on production where wp is up to date while on development is 5.5.

    I use has_block function to check if post has youtube embeds.
    On development(5.5) after post updating has_block('core-embed/youtube')==TRUE while on production(5.6) new posts and updated ones with Youtube blocks are now has_block('core-embed/youtube')==FALSE but has_block('core/embed')==TRUE

    I didn’t check the reason, sorry,
    my quick fix is has_block('core/embed') || has_block('core-embed/youtube')

Viewing 1 replies (of 1 total)
  • @mrerrand In WordPress 5.6 the embed block was changed to use a new feature called block variations for the different types of embed provider. Now instead of multiple blocks for each type of embed, there’s one embed block.

    The youtube variations do have an attribute in the HTML "providerNameSlug":"youtube", so that might be one way to check for youtube blocks in PHP, but granted that’s not as easy as using has_block.

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