I am getting an error when attempting to run DW Promo bar and XML Sitemap. Can you tell me why?

When I attempt to run the DW Promo Bar and XML Sitemap at the same time, I am getting this error:

Fatal error: Cannot redeclare register_mysettings() (previously declared in /home/cj1999/public_html/wp-content/plugins/dw-promobar/dw-promobar-option.php:18) in /home/cj1999/public_html/wp-content/plugins/xml-maps/google-sitemap.php on line 45

Please explain and let me know if I need to use a different sitemap plugin or what the issue could be please.

  • aristath

    Hello again @cornelius_butler,

    When coding a WordPress plugin, one of the best practices to follow is to prefix all functions with something unique. See http://codex.wordpress.org/Writing_a_Plugin#Plugin_Development_Suggestions for more details:

    All the functions in your Plugin need to have unique names that are different from functions in the WordPress core, other Plugins, and themes. For that reason, it is a good idea to use a unique function name prefix on all of your Plugin's functions. A far superior possibility is to define your Plugin functions inside a class (which also needs to have a unique name).

    register_mysettings is NOT unique... far from it!
    It should be for example dw_promobar_register_settings or somethig simlar.
    In this case, both plugins use the same name for a function, which causes PHP to crash spectacularly.
    I would advise you to contact both the developers of these 2 plugins and urge them to prefix their functions with a unique identifier.

    Cheers,
    Ari.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.