WordPress menu in Codeigniter controller

I try to call from my Codeigniter controller as outside of the box my WordPress blog menu, but I get the following error

Fatal error: Cannot redeclare site_url() (previously declared in /../system/helpers/url_helper.php:53)





public function getWordpressMenu() {
        ini_set('display_startup_errors', 1);
        ini_set('display_errors', 1);
        error_reporting(-1);

        // no theme output
        define('WP_USE_THEMES', false);
        // initializes the entire WordPress
        require $_SERVER['DOCUMENT_ROOT'] . 'blog/wp-blog-header.php';
        wp_nav_menu('your_theme_menu_location');


    }

I know both of frameworks have the same function but is there a way to disable on of inside of controller?

Related posts

Leave a Reply

1 comment

  1. In Codeigniter you can simply replace your helpers by creating a new file at application/helpers

    In your case, you can simply create a new file at application/helpers with name url_helper.php

    Just copy the url_helper.php from the folder system/helpers and copy it to application/helpers/ . Now Open the file url_helper.php and rename the function url_helper to something else, for example: ci_site_url