Support » Plugin: Duplicate Menu » [Plugin: Duplicate Menu] Parse error on activation

  • Resolved araucaria


    When I activate the plugin it throws an error:
    Parse error: syntax error, unexpected T_FUNCTION in /home/tgc_dev/ on line 41

    I edited the code to make the creation of the page a separate function:

    // WordPress actions
    if( IS_ADMIN )
        add_action( 'admin_menu', 'duplicate_menu_admin_page' );
    function duplicate_menu_admin_page () {
    	add_theme_page( 'Duplicate Menu', 'Duplicate Menu', 'manage_options', 'duplicate-menu', array( 'DuplicateMenu', 'options_screen' ) );

    With that change the plugin seems to work fine. Thanks for this – I’ve been looking for a way to easily duplicate a menu!

    – Chris

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thank you Chris.

    Faced the same issue, came here to report and found your working solution!

    Awesome, the fix works!

    This plugin will save me so much time 😀

    Plugin Author Jonathan Christopher


    Thanks for the report/feedback. I’ll make sure to make the change for the next release, the way the function is implemented is a PHP 5.3+ feature, sorry about that!

    Plugin Author Jonathan Christopher


    Version 0.1.1 solves this issue, thanks again!

    Hi Jonathan, great plugin which will come in very handy. My problem is that I get the following error when I use it and it gives a partial copy.
    My menus are quite large as we are an online directory so I presume that may be the timeout problem

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\new\wp-includes\plugin.php on line 161

    Not sure that anything can be done about this but thought I’d ask.
    By the way I’m doing this on my local WAMP machine so no host gets upset


    Fred Morgan

    Plugin Author Jonathan Christopher


    Hey Fred, those must be some huge Menus! It makes sense that you get a partial copy because the plugin periodically saves the Menu it’s working with as it’s working with it. I’ll see what I can do to alter the execution time, but if it’s possible for you (and I think it should be in your local environment) you can edit your php.ini file and update the max execution time.

    Hi Jonathan, yes it is pretty big and maybe get bigger as the the site expands. It also goes to 2nd, 3rd and 4th sub-menu levels.
    Should have thought about the php.ini file which at local machine is accessible so will try it and let you know.
    Working on local level is fine but problem will come if/when I want to import/export just the menu which I don’t believe is possible at the moment. That would be good to get your teeth into.

    Regards and thanks


    Plugin Author Jonathan Christopher


    Yeah definitely let me know if editing your php.ini works locally. In the meantime there are some things I can do in the plugin programmatically to increase that time limit just for the plugin script execution itself.

    I think you’re right, that it’s not possible to import/export Menus by themselves, but perhaps that’s something this plugin could do in a feature version as well… I’ll have that rattle around my brain a little bit!

    php.ini mainmenu-max_execution_time = 60 fixed my problem.



    Sorry should have read max_execution_time = 60

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Duplicate Menu] Parse error on activation’ is closed to new replies.