Support » Plugin: Content Blocks (Custom Post Widget) » Fatal error: Cannot redeclare my_content_block_post_type_init()

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Johan van der Wijk


    Hi wgrivera,

    It seems that you have another plugin installed which uses the same function name to create the custom post type. Could you try deactivating all other plugins and then activating them one-by-one to see which plugin is causing the conflict?

    Hi Johan,

    I deactivated all plugins and only installed custom post type but I’m still getting the same error. I’m on a multisite installation but the version I had installed was working fine on it.

    Plugin Author Johan van der Wijk


    Mmm, that is very strange indeed. I am also using the plugin on several multisite installations without any problems and I have not seen this error.

    It might be that the custom post widget plugin is not only in the regular plugins folder, but also in the mu-plugins folder, as it seems it is trying create the content block custom post type twice.

    If the above is not the case you could try renaming the function my_content_block_post_type_init on lines 111 and 113 of the file post-widget.php as it might be that somewhere in your theme the same function name is being used.

    Renamed the function and it just gave me the error Fatal error: Cannot redeclare my_content_block_post_type_init2()

    If I comment it it will give me an error with the next function. Looks like there is another instance of the plugin. But I can’t find it.

    Plugin Author Johan van der Wijk


    Did you manage to fix this? You could try using ftp to download all the files from your webserver and then search for the duplicate function.

    I haven’t been able to fix it but I will try searching for a duplicate and let you know.

    I searched my entire folder for my_content_block_post_type_init() and only one file came with a result and is post-widget.php inside the plugin folder. I guess there is no duplicate.

    I just found out that the plugin is working on the main site and is only sub-sites that are giving me the error.

    Plugin Author Johan van der Wijk


    The Custom Post Widget is compatible with multi-site installations, so that should not be the issue.

    The fact that it is working on the main site, might point to some issues with the multi-site install. Are you using sub-domains, sub-folders or separate domains for the sub-sites?

    I’m using version 2.4.5, and I was running into this issue on some sites but not others. The solution I came up with was to change the

    require( 'post-widget.php' );

    in line 41 of custom-post-widget.php to

    require_once( 'post-widget.php' );

    Great plugin, by the way!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Fatal error: Cannot redeclare my_content_block_post_type_init()’ is closed to new replies.