• Seems this plugin breaks when updating to WordPress 5.

    Has a conflicting function that had already been defined by what looks like WP itself.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Seems that WordPress 5.0 with the new editor is using a function named “has_blocks” yes. Easy fix for this is to change the function name for the plugin.

    Only one file needs to be updated. Open “plugins/multiple-content-blocks/assets/inc/template-tags.php”.

    Use an editor to replace all occurrences of has_block with for example addon_has block. You might also want to change the_block with addon_the_block.

    You will also have to update the function name in your template files. Then it should work fine again.

    This fix didn’t work for me I still get the same error

    Fatal error: Cannot redeclare has_block() (previously declared in /home/nck/public_html/wp-includes/blocks.php:81)

    Are you sure that you have updated the right place?
    Line 62 in template-tags.php should look like this:

    function addon_has_block( $name, $args = array() ) {

    OK it does seem to be working now. I changed the file before updating to WP 5. Not sure if this made a difference or not.

    Thanks for the fix though! I use this plugin a lot so very helpful.

    Nope sorry my bad, does work!

    • This reply was modified 5 years, 7 months ago by montey11.

    This is Broken with WP 5.0, that fix did work for me.

    Thread Starter David


    Thanks, the fix worked for me!

    Thanks @pmbs, that worked. I only applied the first change (has_block > addon_has_block) and it worked perfectly.

    worked like a charm – thanks for the save! 🙂

    Hi there

    Wiiii – Got it working 🙂
    Though .. when i edit my page is says : multiple-content-blocks (inactive)

    How can i active theese blocks?
    Read something like : https://www.bleepingcomputer.com/forums/t/555074/plugin-multiple-content-blocks-not-appearing-on-wordpress-site/

    But i just don´t get it

    Really hope you can help


    1) I recommend using the prefix mcb_ (short for multiple content blocks), so the function names will be mcb_the_block(), mcb_has_block(), mcb_get_the_block(). The plugin already defines other functions with the same name so this prefix is logical.

    2) I recommend changing your theme code that uses has_block() / the_block() using function_exists(). That way, the site wont display fatal errors / display a white screen.

    Thanks so much @pmbs it worked for me!

    Amazing fix @dmgruben and @pmbs – Thanks for saving my prehistoric website after it became extinct.

    Massive thanks @pmbs and @dmgruben

    I host a website for a small non-profit business and these pointers helped fix their issue.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Broken with WP 5.0’ is closed to new replies.