Mage Enabler

Update (May 12, 2010): Mage Enabler is now available in the Official WordPress Plugin repository. Get it here!

It’s been a while since I posted my tweak that allows Mage object to be utilized within any WordPress installation. The tweak requires the blog owner to modify functions.php as stated in my post. I’m inspired by the feedback of the readers who used the tweak so I decided that a plugin that does the same thing should be made to prevent modifying the WordPress core files thus preventing the tweak to cause inconsistencies when an upgrade is necessary.

It is my pleasure to introduce to you, Mage Enabler plugin. Just copy the whole code snippet below and save it as mage-enabler.php. Place it inside a folder named mage-enabler together with the readme.txt available right after the code block. Please take time to read and follow the readme.txt instruction on how to install the plugin in your WordPress setup.

How to use the plugin?

To show you how the plugin works, I’ve decided to convert my example in my previous post by providing a single login page for both WordPress (subscriber) and Magento (customer). This setup assumes that the account credentials (subcriber/customer) in both database are the same and that the function collision problem between WordPress and Magento has been fixed. If you followed the functions.php update in that post, remove the block of code added at line 4123 to 4138.

Location of functions.php


Let’s start by opening the index.php file of the WordPress theme Twenty Ten. I’m using version 3.0-beta1 of WordPress in this article. You can replicate the same code update to any WordPress version and theme you have.


Copy the necessary codes (lines 16-18 and 22-40) to make it similar below:


 * The main template file
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more:
 * @package WordPress
 * @subpackage Twenty Ten
 * @since 3.0.0
 	Mage::getSingleton('core/session', array('name' => 'frontend'));

<?php get_header(); ?>
<!-- Magento's custom greeting -->
<div style="font-size: 15px; margin-bottom: 15px; border-bottom: 1px solid #000; padding-bottom: 10px;">
	$session = Mage::getSingleton("customer/session");
	$magento_message = "Welcome ";
	// Generate a personalize greeting
		$magento_message .= $session->getCustomer()->getData('firstname').' ';
		$magento_message .= $session->getCustomer()->getData('lastname').'!';
		$magento_message .= "Guest!";

	echo $magento_message;
<!-- End of Magento's custom greeting -->

The purpose of the code change above is to display a ?Welcome [customer name here]? when a customer is logged in, and show ?Welcome Guest? when they are not. Make sure that if you’re going to use any Magento related script in your code, always write it within the following if condition:

	// Write your Magento codes here

This will prevent your page or theme files from breaking up if in case the plugin is deactivated, not working or if Mage.php can’t be found.

Open user.php file found at following address below:


Locate the function wp_authenticate_username_password() and find the similar code below. I found mine at line 108.

	if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) )
		return new WP_Error('incorrect_password', sprintf(__('<strong>ERROR</strong>: Incorrect password. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));

Right after the code above, add the following code starting at line 111 to make it similar to the code below. This update allows us to run the login request of Magento within WordPress:

	if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) )
		return new WP_Error('incorrect_password', sprintf(__('<strong>ERROR</strong>: Incorrect password. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
	// Start Magento
		Mage::getSingleton('core/session', array('name' => 'frontend'));
		$session = Mage::getSingleton("customer/session");
			$login = $session->login($username, $password);
		}catch(Exception $e){
			// Do nothing

Finally, to call the Magento’s logout function, locate the file below and open it:


Find the switch case statement at line 352. Add the necessary code to make it similar to the code below and save it:

switch ($action) {

case 'logout' :
	// Start Magento
		Mage::getSingleton('core/session', array('name' => 'frontend'));

Now test your WordPress by accessing the homepage at http://localhost/wordpress/. It should display the ‘Welcome Guest’ similar to the image below with a cookie named as ‘frontend’ in your Firebug cookie tab. That is your Magento cookie.

A Test WordPress homepage showing the default welcome message for Magento
A Test WordPress homepage showing the default welcome message for Magento

Clicking the login for WordPress redirects us to the login form like the one below while still showing the ‘frontend’ cookie. Since I have a customer with same credentials on both Magento (Customer) and WordPress (set as Subscriber), all I have to do is to use the username and password to login in the form below.

A Test WordPress login page with a generated Magento cookie
A Test WordPress login page with a generated Magento cookie

At this point, your Magento session should be running with an active customer session. To check if it does, go back to your homepage by clicking the top header text or going to http://localhost/wordpress/. It should display now the welcome message with your customer’s name.

A Test WordPress homepage showing the customer's name in the welcome message
A Test WordPress homepage showing the customer's name in the welcome message

For those who will use this plugin, let me know the version of WordPress and Magento you’re using so I can keep track of the list of versions in which this plugin is compatible. Until such time that the plugin is moved to the Official WordPress Plugin repository, I’ll accept and answer inquiries here thru comment/feedback form below. Mage Enabler is now available in the Official WordPress Plugin repository. Get it here!

About the author

Richard Feraro is a Magento Enterprise Certified developer from Manila, Philippines with 14 years of solid open-source development experience using Linux, Apache, MySQL & PHP.

By Richard Feraro

Richard Feraro is a Magento Enterprise Certified developer from Manila, Philippines with 14 years of solid open-source development experience using Linux, Apache, MySQL & PHP.

205 thoughts on “Mage Enabler: A plugin to run Magento's session within WordPress”
  1. Great work Richard!

    This is really getting interesting. I have been using Joomla with Magento for a couple of webshops but it feels like overkill most of the time. So a WordPress-Magento bridge plugin looks like a killer app!

    I hope I will have time testing it during the summer…

    1. Check the following:

      1. Is Mage Enabler installed?
      2. Is it Activated?
      3. Did you supply the absolute URL of your Mage.php? Which of the following below is displayed when you supply the absolute URL?
        • Invalid URL
        • File is accessible!
        • Mage object not found!
  2. Looks like I have a final step of adding the Absolute URL:
    Here’s the location of the Mage.php
    Wondering what I put into the Absolute URL field.
    I’m hoping this will enable the Welcome Guest! comment to show.

  3. Hi Richard, first thank you for this awesome plugin, this is just great work!
    I’ve installed the plugin and followed all the instructions as you said in this post but i have some trouble and i don’t know what is causing it. My problem is I’m getting the “Welcome Guest!” text but when i login into wordpress it remains the same. it doesn’t reflect my username, I can see the “frontend” cookie showing up. When I go to magento the same happens, it doesn’t show my username. What am i doing wrong? Another question i have, since is a little bit confusing for me is do i need to be registered in magento and wordpress with the same user and same password in both platforms? sorry if this last question is silly, I have little programming skills.
    I’m using wordpress 3.0 and magento 1.4. Another thing I’m seeing is two frontend cookies, one for magento and another for wordpress. Thank you in advance for your help!

    1. Hi Camilo 🙂

      Thanks for using the plugin and reading my blog. Regarding your question, if you follow the modification in index.php, user.php and wp-login.php, manually create the same username and password in Magento and WordPress. Just go through the usual way registering to each application then test it again. That’s what I did to test if it works 🙂

      Thanks again.


  4. first, great blog! second, Im having an issue getting this to work. I have the plugin installed and it points to the absolute url for Mage.php at /var/www/vhosts/….etc

    I have all php errors turned on at .htaccess level in WP, but im still only seeing a blank white page.

    any help would be great! im using latest WP and Mage.

    What I am trying to do get the head, header and footer from Magento to be displayed on the WP install.

    thanks in advance!

    1. Hello Gregg,

      Try placing the error_reporting(E_ALL) within the file your working on just above the script where you added the Magento call. It happened to me one time when I tried to declare the error_reporting in .htaccess but still got a blank screen. Let me know the output. Blank screen means there’s a Fatal error within the file.


      1. thanks Richard,

        i realized I needed to get rid of Magento’s __() function so I did add the /app/code//local/Mage/Core/functions.php tweak you suggested.

        now my error is related to another plugin (wordpress breadcrumbs), so thanks for the help! you got me in the right direction.

        1. Hi Greg,

          If you’re already using the Mage Enabler plugin, you don’t have to edit and add the tweak to functions.php anymore since the plugin already does that for you. You still need to get rid of the Magento’s __() translation function though.

          Ooops! My bad 🙂 I thought you we’re referring to WordPress’ functions.php. Glad that you were able to solve it 🙂

          Thanks 🙂

  5. Hallo Richard,
    very useful plugin and very well supported tru your blog.
    I’ve successfully get rid of magento ___() function, installed mage-enabler and get the right absolute URL for for mage.php.
    Now, I’m not very interested in the double log in but I just want the magento store running inside my wp! I’m a little puzzled about where to place the call to magento. I’m thinking about create a wp-page called store, create a template for it and inserting the call to magento stuff in there (as described in the various comment to this and to the other post). Is it correct?

    Thank you for doing this!


    1. Hello Mik! Thanks for spending time reading my article.

      Yes, you’re right regarding the technique you mentioned. The best places I think to add the Magento call are the following files within your template folder: index.php, header.php or try functions.php if you’re template has one. Just make sure you’re Magento call is on top of the page where there’s no header request or you’ll encounter the error I mentioned in the post. You can test which one is the right file for your template by checking if you’re blog creates a frontend cookie when accessed thru a browser.

  6. Hallo Richard, well spent time reding your blog 😉

    Back to php stuff, I’ve put the php call ( * Run Magento’s Mage.php within WordPress
    etc…) inside my wp-content/theme/mytheme/functions.php
    Than, I’ve created a template to embed the magento code in my wp’s “store” page
    and placed the function BEFORE the header call, like this:

    Template Name: store
    <?php get_header(); ?>

    So I’ve put some simple magento code in the page wrapped in if function

    	// Write your Magento codes here
    require_once 'app/Mage.php';
    //not Mage::run();
    //code snipped
    $className = Mage::getConfig()
    $block = new $className();
    echo $block->renderView();

    but I still get the infamous Fatal error: Uncaught exception ‘Exception’ with message ‘Warning: session_start() etc etc (20 lines…)

    Where did I get wrong?

    Thanks a lot

    1. If you have installed and activated the Mage Enabler plugin and supplied the absolute URL with no error after saving it, you don’t have to use magento() anymore. You also don’t need the following lines because the plugin already does this for you:

      require_once 'app/Mage.php';
      //not Mage::run();

      You just have to use the following code at the top of your page where you want to call Magento’s object (this is the one that creates the frontend cookie):

      // Start Magento
          Mage::getSingleton('core/session', array('name' => 'frontend'));

      in the same file but in a different location depending on what you’re trying to do, add your own Magento calls:

          //code snipped
          $className = Mage::getConfig()->getBlockClassName('catalog/product_events');
          $block = new $className();
          echo $block->renderView();
  7. Hi Richard,
    I’ve tryied going the easy way as you described: no more fatal error and the frontend cookie appears.

    I’ve my ‘store.php’ page with //start magento on top (before header!) and the code snipped you’ve suggested somewhere in the page where’d like to dislplay the magento’s stuff. But I get this error loading the page:

    Fatal error: Class ‘Mage_Catalog_Block_Product_Events’ not found in /var/www/myhost/wordpress/wp-content/themes/mytheme/store.php on line 46

    here comes the pages’s code:

    Template Name: store
    // Start Magento
        Mage::getSingleton('core/session', array('name' => 'frontend'));
    <?php get_header(); ?>
    <div class="clear"></div>	
    <div id="catmenucontainer">
    	<div id="catmenu">
    				<?php wp_list_categories('sort_column=name&title_li=&depth=4'); ?>
    <div class="clear"></div>
    <div id="content_store">
    <!-- inserting magento's ciccia -->
        //code snipped
        $className = Mage::getConfig()->getBlockClassName('catalog/product_events');
        $block = new $className();
        echo $block->renderView();
    <!-- end ciccia -->
    	<div id="navigation">
    	<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  
    <?php get_footer(); ?>

    I can feel I’m close to the solution…

    Thank you for your commitment!



  8. My bad, I see I were trying to add stuff I didn’t have on my magento such as ‘catalog/product_events’ or ‘catalog/product/homepageevents.phtml’

    I’ve tried inserting instead the code for the cart and … uuuuu … it works!
    Now I’ve understand how to handle this magento code…

    Thanks a lot for your help!


  9. Nice plugin but just dosen’t seem to work for me… I have tried both theories (the plugin & manually adding the script) i get all the signs of it working i.e the frontend coming through the wp-login HOWEVER…. I can’t seem to get it login in via my wordpress and make it login through magento,
    I m using WP 3 magento 1.4, what i have noticed is that when you login to wordpress you are asked for your USERNAME and PASSWORD, when you login to Magento it asks you for EMAIL ADDRESS AND PASSWORD.. I am assuming this is why you can login via wordpress to both WP & Magento?


  10. Hallo Richard, here I come again!

    I’ve a new problem since I’m using the xml-rpc API [] it works like a charm until I activate the mage-enabler plugin. When I turno on your plugoin the xmlrpc.php goes nuts and report this error:

    Fatal error: Uncaught exception 'Exception' with message 'Warning: Varien_Autoload::include(WP/User/Search.php) [<a href='varien-autoload.include'>varien-autoload.include</a>]: failed to open stream: No such file or directory in /var/www/mysite/magento/lib/Varien/Autoload.php on line 93' in /var/www/mysite/magento/app/code/local/Mage/Core/functions.php:248 Stack trace: #0 /var/www/mysite/magento/lib/Varien/Autoload.php(93): mageCoreErrorHandler(2, 'Varien_Autoload...', '/var/www/mysite...', 93, Array) #1 /var/www/mysite/magento/lib/Varien/Autoload.php(93): Varien_Autoload::autoload() #2 [internal function]: Varien_Autoload->autoload('WP_User_Search') #3 [internal function]: spl_autoload_call('WP_User_Search') #4 /var/www/mysite/wordpress/wp-admin/includes/user.php(472): class_exists('WP_User_Search') #5 /var/www/mysite/wordpress/wp-admin/includes/admin.php(46): require_once('/var/www/mysite...') #6 /var/www/mysite/wordpress/xmlrpc.php(54): include_once('/var/www/mysite...') #7 {main} thrown in /var/www/mysite/magento/app/code/local/Mage/Core/functions.php on line 248

    Any idea?




    1. The xmlrpc setting is found in an admin page. Are you doing any Magento calls within the admin? There’s nothing in the error that says Mage Enabler is the culprit. The xmlrpc in my blog is actually enabled too with Mage Enabler installed as well.

  11. uhm, actually it shouldn’t be any connection bettween mage enabler and the xmlrpc. I’m using it just to get an xml list of wp pages to create a flash menu. but without even linking magento or any wp pages with magento the file at stops working. I was just wandering how it would be that xmlrpc get an error related to a magento’s function!

  12. Hallo Richard, glad to be helpful. I’ve installed the latest mage-enabler version and now the xmlrpc goes like a charme. Unfortunately now I get a similar conflict/error with the popular plugin swf-object:

    Fatal error: Uncaught exception 'Exception' with message 'Warning: Varien_Autoload::include(Swfobject.php) [<a href='varien-autoload.include'>varien-autoload.include</a>]: failed to open stream: No such file or directory in /var/www/toystoys/magento/lib/Varien/Autoload.php on line 93' in /var/www/toystoys/magento/app/code/local/Mage/Core/functions.php:248 Stack trace: #0 /var/www/toystoys/magento/lib/Varien/Autoload.php(93): mageCoreErrorHandler(2, 'Varien_Autoload...', '/var/www/toysto...', 93, Array) #1 /var/www/toystoys/magento/lib/Varien/Autoload.php(93): Varien_Autoload::autoload() #2 [internal function]: Varien_Autoload->autoload('swfobject') #3 [internal function]: spl_autoload_call('swfobject') #4 /var/www/toystoys/wordpress/wp-content/plugins/nextgen-gallery/lib/swfobject.php(2): class_exists('swfobject') #5 /var/www/toystoys/wordpress/wp-content/plugins/nextgen-gallery/widgets/widgets.php(53): require_once('/var/www/toysto...') #6 /var/www/toystoys/wordpress/wp-content/plugins/nextgen-gallery/widgets/ in /var/www/toystoys/magento/app/code/local/Mage/Core/functions.php  on line 248

    My silly solution is just to comment out line 248 in var/www/mysite/magento/app/code/local/Mage/Core/functions.php

    throw new Exception($errorMessage);

    Well, know the error doesn’t show in wp anymore and swf-object plugin is back to work as usual. Even Magento seems running quite well, anyhow I suppose there’s something wrong.

    Your thoughts?

    Thank you


    1. I’m not sure yet unless I could see how that plugin works. Any sample site where I can see the error? How about additional details such as which file is showing an error? Does this error occurred prior to your xmlrpc.php inquiry? How can I replicate the error on your end?

      1. im using windows, n my hosting is linux. i can only found /wp-content/plugins/mage-enabler. but cant find any other magento folder. is it i miss any step for installing?

  13. I am trying to get the magento header to display in wordpares using

    $className = Mage::getConfig()->getBlockClassname('page/html_header');
    $block = new $className();
    echo $block->renderView();

    The logo and slogan images display but its missing links, cart, search and menu.

    Any ideas?

    1. Hi Mark,

      Thanks for reading the article. If you check my example above, it doesn’t have the links, cart info and other information you’re looking for because it is the header block only. The HTML blocks you’re looking for are found in the other blocks such as ‘catalogsearch/’ and ‘catalog/navigation/top.phtml’.

      Check the comments of peaker from the other article on how he did it here.

  14. Perhaps I am a little slow today. I took a look at the other comments but I must be missing something.

    How would I do the following for topLinks?

    	$topLinks = $magento_block->createBlock('???/???');
    <?php if(class_exists('Mage')){ echo  $topLinks->toHTML(); } ?>


  15. I get this error.

    Fatal error: Call to undefined function isloggedin() in /public_html/blog/wp-content/themes/twentyten/index.php on line 12

    Here is my code.

    // Start Magento
        Mage::getSingleton('core/session', array('name' => 'frontend'));
    <?php get_header(); ?>
    		$magento_message .= $session->getCustomer()->getData('firstname').' ';
    		$magento_message .= $session->getCustomer()->getData('lastname').'!';
    		$magento_message .= "Guest!";
    # Initiate Blocks
    $linksBlock = $magento_block->createBlock("page/template_links");
    $checkoutLinksBlock = $magento_block->createBlock("checkout/links");
    $wishlistLinksBlock = $magento_block->createBlock('wishlist/links');
    # Add Links
    $linksBlock->addLink($linksBlock->__('My Account'), 'customer/account', $linksBlock->__('My Account'), true, array(), 10, 'class="first"');
    if ($session->isLoggedIn()) {
        $linksBlock->addLink($linksBlock->__('Log Out'), 'customer/account/logout', $linksBlock->__('Log Out'), true, array(), 100, 'class="last"');
    } else {
        $linksBlock->addLink($linksBlock->__('Log In'), 'customer/account/login', $linksBlock->__('Log In'), true, array(), 100, 'class="last"');
    echo $magento_message.''.$linksBlock->renderView().'';
    <!-- End of Magento's custom greeting -->

    Funny thing is when I first got this I removed that section and the links came up but but know if i remove it i get “Call to a member function createBlock() on a non-object in…”. Looks like something else might have been changed.


  16. Thanks for this awesome extension. I’m wondering about the customer/user tables within the two applications, does it interfere with rights assigned from the backend to the logged in user of either app? Is a customer that checks out a wp user and if not how could we sync the two?

    1. Hi Bill, thanks for the feedback.

      Regarding your question, the plugin does not interfere with whatever access rights and permission assigned to the user in both application by default. Since the plugin somewhat provides you with raw access to Mage object, it can however modify a user’s permission through that.

      The user by default isn’t logged in automatically on Magento when they access and logged in to WordPress. In order to do that, you can use the Mage object also to login the user in Magento automatically upon logging in to WordPress like my example in the other article I posted last April. You might wanna read my reply to a user named Jim because it could be relevant to what you want to achieve in your application. Check it here.

  17. Richard,

    Thank you for your response. I was able to configure WordPress as the root domain and Magento as a subdirectory or I’ve installed the mage enabler and got an error message until I made the adjustments to magento’s functions.php. My problem is creating a subscriber in WordPress does not create the customer in magento and the code example on running magento’s session within wordpress does not pull magento’s header or anything into it.
    Wordpress say’s it see the mage.php. Do I have to make any further code adjustments, scowering your blog I’m getting a little confused with exactly what to modify. My idea is to run a blog with buddypress plugin and a magento shop. I need to have a wordpress subscriber created once a customer creates an account during checkout. I’d also like to have a magento customer created when a subscriber creates an account from wordpress. You mentioned I could use a single table for customers/subscribers but this maybe a little beyond me. Synchronizing Magento’s customers to WordPress subscribers would be fine handled because not all subscribers would be customers. Can you see any way to accomplish this? Thanks again for your assistance.

    1. Hi Bill,

      The only thing that Mage Enabler does is to include Mage.php in your WordPress instance and run Mage::app(‘default’). You have to code the rest of the functionality that you need to implement in your WordPress. I do posted some samples here which are as follows:

      Inserting blocks, CSS and JS files from Magento to WP
      Single login between Magento and WP (although the actual user creation isn’t included)

      The codes below can also be applied:
      Adding products with custom options
      Cancel Cart/Quote of Magento from external site
      Check the login status of a customer

      Plus, there are a lot of examples in the net that uses Magento’s Mage.php can also be used with Mage Enabler.

  18. Ok I was confused. I thought this plugin would enable WordPress to Magento capability for a normal WordPress user. It would be nice if you could package up some type of communication between the two systems that would allow a normal WordPress user to use Magento’s capabilities within WordPress. I’m not putting you down at all for this contribution it’s just a little confusing and time consuming to implement. Having a single sign on between the two applications would be nice along with passing customers, orders and content between the two frameworks.

    1. I think you’re looking for a different plugin and Mage Enabler isn’t for you. Like what you said, you want to use WordPress to your Magento. That’s not what Mage Enabler is for. What the plugin does is to use Magento into WordPress using its session not the other way around. Lazzymonks plugin for Magento us what you need.

  19. Ok maybe not the actually content because each application does quite well with managing it along. I’d just like to be able to pass customers that signup from the Magento checkout through to WordPress as subscribers or other role.

    1. Mage Enabler doesn’t do that. If your primary is purpose is to let Magento do the managing of user roles from Magento to WordPress, better look for a Magento plugin in Magento Connect.

  20. I’m trying to get your plugin to work but keep getting the invalid url message. I have magento set up as a root install and wordpress in installed in a root folder.

    They are both installed in their own databases.

    The url for the mage file is

    Should they be sharing the same database? Is there a problem with the way they are installed?

    Thanks in advance.

    1. I?m trying to get your plugin to work but keep getting the invalid url message. I have magento set up as a root install and wordpress in installed in a root folder.

      They are both installed in their own databases.

      The url for the mage file is

      You need the local absolute URL not the web address.

      Should they be sharing the same database? Is there a problem with the way they are installed?

      The database has nothing to do with your error. The plugin only need an absolute URL.

      Look or search for the word “absolute” in the comments area in this page so you’ll have an idea what is Mage.php’s absolute URL.

  21. Hey Richard,

    I think I got the right url, i’m now getting this error message;

    Cannot redeclare __autoload() (previously declared in /home/mysite/public_html/wordpress/wp-content/plugins/connect2MAGE/connect2MAGE.php:52) in /home/mysite/public_html/app/code/core/Mage/Core/functions.php on line 69

    1. That’s not my plugin. It’s connect2Mage like what the error shows. Also, I would expect the same error with any plugin that uses the same application (Magento) since they both utilize the same function. Your error says __autoload() is already declared because you’re using two plugins that links to the same single external application.

  22. sorry about that, here’s the error w/out the other plugin activated:

    Fatal error: Cannot redeclare __() (previously declared in /home/mysite/public_html/wordpress/wp-includes/l10n.php:96) in /home/mysite/public_html/app/code/core/Mage/Core/functions.php on line 96

    1. It’s the function collision between Magento and WordPress. Read the article above, the solution is found in the first paragraph of ‘How to use the plugin?’ section with a link provided on how to fix it.

      1. The way I understood that paragraph was that anything that your previous posts stated to do were not required since t you released the plugin. Might make it more clear if you added it to the read me file. Thanks for your help.

        1. I think you misunderstood that phrase. It was never mentioned in any of my post that “that anything that your previous posts stated to do were not required since t you released the plugin“. If you read the article and comments here, you will know that it is referring to the code below which was mentioned in this page too (see comment):

          require_once 'app/Mage.php';
          //not Mage::run();

          Maybe you were referring to this comment too? The tweak mentioned here is the function magento() added in the WordPress functions.php which was the original code before the plugin even existed. That function magento() also contains the very same code:

          require_once 'app/Mage.php';
          //not Mage::run();

          The plugin as stated in the description, requires PHP programming. That’s why I don’t see the point why would I tell the readers here to ignore the Magento/WordPress related articles I’m tirelessly posting here in my blog.

  23. update: ok i deleted the line 96 which is the translate line you have crossed out above response,

    “If you?re already using the Mage Enabler plugin, you don?t have to edit and add the tweak to functions.php anymore since the plugin already does that for you. You still need to get rid of the Magento?s __() translation function though.”

    Thanks for your patience, now I to actually get the cool stuff happening….

  24. Hi Richard,

    Working on changing the way I integrate Magento and WordPress to use your new plugin and I’m running into a (hopefully easy-to-fix) issue.

    I’ve installed the plugin, filled in the absolute path to the Mage.php (File is accessible!). In one of my pages, at the very top of the file I’ve added the following:

    echo “YES”;

    And nothing happens, apparently the Mage class doesn’t exist. What am I missing?

    I’m using WP 3.0 and Magento

    Thanks as always!

    1. Hey Richard,

      I was running into this issue locally, so I decided to test further to see if I could replicate the issue on my server. And oddly, it works fine on my server. It’s strange that it doesn’t work locally. I’m running Xampp locally, but have never really run into an issue where something doesn’t work locally, but works online. If you happen to have any thoughts, would definitely appreciate it.

      Thanks again,

      1. I do have several setup of different version of WordPress including Thelonious. All of them are using Mage Enabler plugin running in XAMPP for Windows (XP). Hmm, could it be a cache issue? Is the file you’re using a template file or some built-in WordPress core files?

      1. Hi Richard,

        Unfortunately, still not working locally. I made sure the cache wasn’t an issue and created an else clause to make sure the page outputs at least something and it does…what I put in my else clause.

        The file I’m running is a template file. I create a “Page” in WordPress and then choose the template file as the template. Which is the exact thing I do on my live server, which oddly works.

        I checked to see if a cookie is being created in Firefox and it’s not. Just to double-check, I looked at the page online and it is creating a cookie. Very strange!

        If you have any other recommendations, please let me know.

        Thanks for your help as always!


        1. Hmm, that’s weird. If you get the ‘File is accessible!’ message in the admin, it means Mage object is existing like what the plugin code says:

          $message = ( class_exists( 'Mage' ) ) ? 'File is accessible!' : 'Mage object not found!';

          Try doing the code below on the same page your working on. Is should show an array of all the classes that has been declared.

          echo "<pre>";
          echo "</pre>";

          Do this code also. It will generate the cookie named ‘frontend’. If it does then it should be working properly.

          	// Instantiate session and generate needed cookie
          	Mage::getSingleton('core/session', array('name' => 'frontend'));
  25. Hi Richard,

    I tried searching everywhere and can’t understand why I keep getting “invalid Url” it’s maddening. I’ve tried the only absolute url i know which is “” but it still will not work. I know someone else asked the same question, but I couldn’t find a concrete example of what it should look like. I even checked out the post on that you replied to, like 2 hours ago, but that didn’t work either. I would love to get this working:)

    1. Try this:

      Navigate to your Magento installation. Locate and open the .htaccess file using a text editor:

      Comment out the content per line. It should look like something similar below:
      #Order deny,allow
      #Deny from all

      We did this to disable the restriction in viewing files under this directory. You MUST restore this later.

      Create a file under the same directory and rename it with a .php extension name. Open this file and add the following lines:


      Save the file and access it via browser (
      Locate the line that says:

      SCRIPT_FILENAME C:/xampp/htdocs/magento/app/your-file-here.php

      Just replace your-file-here.php with Mage.php and copy the whole URL to the Mage Enabler setting textbox and hit Save.

      Restore your .htaccess to its original content like the one below or everyone will be able to access your Mage.php publicly:
      Order deny,allow
      Deny from all

      Delete your-file-here.php that you created earlier. The content of this file will expose most of your Apache server settings.

  26. I Fixed the absolute URL, Now I get a fatal error. What could this be from? I don’t have any SEO plugin installed either.
    Fatal error: Uncaught exception ‘Exception’ with message ‘Warning: include(All/In/One/SEO/Pack.php) [function.include]: failed to open stream: No such file or directory in /home

      1. I get the following fatal error after successfully linking Mage.php and after I’ve followed all the instructions in this post. I’m useing WP 3.0 and Magento 1.4. If I comment whatever is at line 248 on the functions php the error goes away but loging into mageto with WP credentials doesn’t work. Thank you for checking it out.

        Fatal error: Uncaught exception ‘Exception’ with message ‘Warning: include(All/In/One/SEO/Pack.php) [function.include]: failed to open stream: No such file or directory in /home/myserver/public_html/shop/lib/Varien/Autoload.php on line 93′ in /home/myserver/public_html/shop/app/code/local/Mage/Core/functions.php:248 Stack trace: #0 /home/myserver/public_html/shop/lib/Varien/Autoload.php(93): mageCoreErrorHandler(2, ‘include(All/In/…’, ‘/home/myserver/…’, 93, Array) #1 /home/myserver/public_html/shop/lib/Varien/Autoload.php(93): Varien_Autoload::autoload() #2 [internal function]: Varien_Autoload->autoload(‘All_in_One_SEO_…’) #3 /home/myserver/public_html/wp-content/themes/Apz/functions/admin-functions.php(1097): spl_autoload_call(‘All_in_One_SEO_…’) #4 /home/myserver/public_html/wp-content/themes/Apz/header.php(5): woo_title() #5 /home/myserver/public_html/wp-includes/theme.php(1086): require_once(‘/home/myserver/…’) #6 /home/myserver/public_html/wp-includes/theme.php(1062): load_t in /home/myserver/public_html/shop/app/code/local/Mage/Core/functions.php on line 248

        1. The All in One SEO Pack plugin for WordPress seems to conflict with Mage Enabler. There’s an spl_autoload_call(?All_in_One_SEO_??) in your theme files that triggers the error. I’ll investigate on the matter and see what can be done.

  27. Greetings Richard,

    Thanks for developing Mage Enabler! It looks like it’s exactly what I’m looking for.

    Since I’m a stronger designer than developer, I was hoping you could give me some advice…

    I want to create a store within a WP website. By using Mage Enabler, will I be able to conduct transactions through WP, or will I have to link visitors to a Magento site? I guess I’m trying to figure out what comes first, the Magento site or WP?

    Do you happen to have a step by step post on building a WP and Magento store? How about any link to sites that are doing that?


    Joseph Rubio (Los Angeles)

    1. Hello Joseph, thanks for taking time checking out my blog. Regarding your question, extending Magento to WordPress using its Mage object is like doing php programming and communicating with a third-party’s application API. In this case, you’re dealing with the Mage class and using its methods to do similar tasks present in the actual Magento instance to your external site (WP). What Mage Enabler does is to allow that Mage object to be instantiated within you WP, making all Magento’s methods accessible from within your blog. That why it is possible to use all the functionality mentioned in the Magento documentation.

      Your setup may vary from one project to another. At one instance you may just need to run a WordPress as front end and Magento’s Admin panel so the default Magento front end isn’t used. Sometimes you may want to use both application’s front end, only getting portions of the functionality from Magento. Either way, it is possible. I still don’t have a step by step converting a WP into a full E-commerce site using Magento but there’s already a lot of blogs, post and articles dealing with manipulation of Mage object by including Mage.php within an external site (which is what Mage Enabler does.)

  28. Richard, your plugin is exactly what i was looking for for some time now.
    What I am trying to to is to insert a product page into a blog post or a blog page. As i am not an experienced Magento developer, i was thinking that you might help me a bit with this one. Let’s say i want to insert the content of product with id 1000. Could you show a few line of code of how to do that from inside wordpress after installing your plugin?

  29. Richard , I want to thank you for your help and for developing this great plug in. It saved me a lot of time and effort .

  30. Hi Richard,

    A genius plugin for sure. Thank you for sharing it.

    Some feedback though. You have hard-coded the ‘default’ store code into the plugin. My magento site does not have a default store – it looks a bit like this.

    website 1 (private), store 1 code: private_nbno
    website 1 (private), store 2 code: private_engb
    website 2 (wholesale), store 1 code: wholesale_nbno
    website 2 (wholesale), store 2 code: wholesale_engb

    So I get a fatal error when the following code is run:
    // Initialize Magento
    Mage::app( 'default' );

    There ought to be an option to specify a non-default store code in the Mage Enabler settings page.


  31. Hi Richard,

    Very cool plugin, well done! This is potentially exactly what I need, in terms of building e-commerce into a WordPress instance. The only thing that I’m having difficulty with is syncronising the Magento database with the WorPress one. Correct me if I’m wrong, but in order for the plugin to allow a magento session to be authorised within WordPress, the user needs to have credentials in both databases?

    Any tips on how to accomplish this automatically i.e when a client checks out in magento it populates the WordPress databse table too?


    1. Hello John, here are my answers to your questions.

      Correct me if I?m wrong, but in order for the plugin to allow a magento session to be authorised within WordPress, the user needs to have credentials in both databases

      Nope. Whether both applications are using the same or different user credentials or none at all, the Mage Enabler can run the Mage object within WordPress. The account-related methods accessible via Mage object are just one the many functionality that can be extended by Mage Enabler within WordPress.

      Any tips on how to accomplish this automatically i.e when a client checks out in magento it populates the WordPress database table too?

      Mage object retrieves whatever is stored in the Magento DB so basically, if you create a new customer in Magento, it can be pulled using the Mage object like this post. It will require additional programming though since you need to detect if a new record has been added and use the built in functions of WordPress to save it in its respective tables.

  32. Question. How can i get Magento store products to display inside my WordPress post and pages with Mage Enabler? I want to have featured products show up in the main page of a customer wordpress site.

    1. Hi Bob, I think there must be a forward slash at the beginning of the absolute URL. Also, start the url from the root it self. www is your webroot so it should begin from the home or root. It should look something like the one below:


  33. I have enabled everything and tried to test if the user was logged in and display there name in the header. The first try it worked, but all of the sudden it stopped working. I am not getting any errors, it just does not think the user is logged in on the wordpress side. If i go into the store it knows I am logged in.

    Any ideas what might be causing this? Thanks!

    1. Try using the following code in one of your theme files. If Mage Enabler is working, you should see Mage and Varien in the array output.

      echo "<pre>";
      echo "</pre>";

      Also, set your error_reporting() to E_ALL to display any possible error in your test server.

  34. I am currently using Magento but I hate the way it looks and it seems much more difficult to design a theme for it than it does WordPress. I am very interested to see your plug-in in action. Can you point me to some live sites are using it?


    1. George, I moved your comments here because you’ve been posting question irrelevant to the thread. Your question has already been answered here.

      Please keep my blog clean by sticking to the topic.

  35. Sorry for posting in the wrong place.

    I checked your link but surprisingly after three months there are still no links to any sites using the Mage Enabler.

    Do you have a test site up running?

    I am new to WordPress and I am just trying to see what the plug-in can do before I invest a bunch of time learning something new.


    1. The test site is still in progress since I’m updating the plugin at the moment for more features such as shortcodes and stuff that pulls block from Magento. I do hope I can release it this November.

  36. Hi, I have read your posts (from the first one), using magento with wordpress with hard code examples and I was amazed with the idea so i followed the links which brought me to your latest post, I was wondering if using the plugin you made, I could, integrate wordpress 3.0.1 with Magento Professional Edition platform and would it be in conflict if I add Quickbook plugins/ IMS for magento as well?

    I hope this idea would suit with what I need.

    Thanks, real nice plugin..

    1. Hi May,

      There shouldn’t be any conflict with other plugins since you’ll be using Mage object to access Magento’s methods, be it in WordPress or other external PHP-based application.

      Thanks 🙂

  37. I followed the instructions and getting:

    Parse error: syntax error, unexpected T_STRING in /home/egypt/public_html/wp-login.php on line 563

    Any ideas? =(

  38. 560 $reauth = empty($_REQUEST[‘reauth’]) ? false : true;
    562 // If the user was redirected to a secure login form from a non-secure admin 563 page, and secure login is required but secure admin
    564 is not, then don’t use a secure

  39. Richard,
    I am using a magento site now and the seo is kind of weak. I want to convert my site to a wordpress site (for seo purposes), then integrate magento as you have. I just wanted to understand more of how wordpress controls the frontend and magento controls the backend. As well as make sure my h1 and h2 tags are above line 233 (current magento site).

    Are there any sample sites that are using your integration that I can inspect the source?


    1. Hi Bryan, most of the users of the plugin I made doesn’t really share the url of the site where they use it. 🙂

  40. That’s unfortunate Richard,
    If I get this working correctly with my site I’ll be happy to share. Do you know of any sites that use it?
    Or do you have a test site out there?


    1. 1. Did you try logging in to WordPress using a subscriber account?
      2. Did you check if there’s a frontend cookie being generated?
      3. What have you done so far?

  41. Yeah for some reason it is redirecting to https. Magento is working under that directory if you use . I wonder if I set it up incorrectly in the first couple install stages.

    the questions above:
    1. I did create an account using subscriber WP/magento (same credentials)
    2. When using firebug I could not see any cookies being created
    3. I went through the setup instructions, clean install of both magento and WP, for your page plugin.

    I bet it has something to do with that redirect to https though…

    1. If you can’t see any cookie being generated (make sure you have Firecookie added in your Firebug tab), add the code below at the very top of the files where you added the Magento scripts within your WP instance. This will display the errors you might be having within the code. Make sure to remove this code once your site is in production stage.

  42. Hi Richard, great plugin.. got a question. I’m building a new wordpress site right now and want include parts of a magento shop wich is hosted on another server. Is this possible too?

    1. Hi Jeroen 🙂

      If you’re going to use Mage Enabler, its primary requirement is the absolute local path to your Mage.php. Consequently, you can’t unless you have administrator access to both hosts which will allow you to do some serious symbolic linking and still you are confined to have the two host accessing each other locally.

  43. Ok, clear.. so it’s probably not going to work. The WordPress site is mine.. the Magento store is from a company that sells some of my goods, I wanted to integrate them in my own site. I’m know with the owners of the store though.

  44. Id like to embed my magento shopping area into a wordpress page. Then add the shopping card module into a widget area in wordpress. Not sure where to start.

  45. Hi Richard,
    I was how the notification from the payment processor is handled when you try to keep the whole shopping experience within a wordpress environment.
    example: the customer selects a product, goes to the payment system, completes payment and then when the payment is successful the payment script does a callback to finalize the order. ( i.e. )

    what do you have to do to handle this within the wordpress environment, so the customer never sees the magento backend?

    1. I believe that every payment facility like PayPal and similar sites allows the administrator to provide a Return URL parameter by which the confirmation will be sent. You just have to redirect it to your WordPress page handling the confirmation.

  46. Hi there!
    This plugin could really solve some of my problems 🙂
    Btw, I’ve installed it correctly (I think) on my localhost and I see the cookie, but when I login I still see the “welcome guest” message.
    I’ve a question: what u mean with same credentials? In Magento I login with email and password, but in WordPress I login with username (not email).
    Second question: can I contact you via private email in case I need some paid works?
    Let me know. 🙂

    1. Hi Daniele!

      The same credentials that I was referring to the post was the customer account in Magento and subscriber account in WordPress 🙂

  47. Hi Richard

    Thanks for your plugin, I’m pretty sure that it’s going to help me in my job

    I have a question, in setting when you ask for Absolute URL of the file, is it possible to have magento and wp in different servers ? cause your example (/home//public_html/app/Mage.php) doesn’t clarify my doubt


    1. Hi Lina,

      It has to be on the same server. What do you plan to use as an absolute path to Mage.php?


  48. Thanks Richard but my site and my shopping are in differents servers, so it’s not working for me

  49. Hi Richard. Thanks for building this plugin, it’s very helpful!

    It loads Magento the way it should, but I’m having trouble getting the sessions (WP and Magento) to work together. I can insert the following code into a php document outside WordPress and it will report accurate numbers regarding items in my cart, but as soon as I drop it into my WordPress sidebar, it says I have 0 items in my cart.



    $cart = Mage::helper(‘checkout/cart’)->getCart()->getItemsCount();

    echo ‘Items in your cart: ‘ . $cart . “”;


    1. Hi Matt 🙂

      Did you place the code below in your template’s index.php, just above the get_header();?

          Mage::getSingleton('core/session', array('name' => 'frontend'));
  50. Hi Richard,

    once again, a very cool and useful plugin. However, I seem to be having a problem that has been addressed here before, only I’m not able to resolve it with sugestions offered.

    I’ve taken care of the function collision problem as instructed. My Mage.php is recognized in the config of the plugin. I’ve added the example code into my WP template header, to make sure it’s loaded on every page. The frontend cookie is being generated just fine. I have matching accounts of WP subscriber and Magento customer.

    But in the end, after logging in via WP, I’m still being greeted as a “Guest” Also, if I get an active Magento session cookie by logging into WP. If I visit my Magento page which is in a subfolder, theoretically I should be recognized as logged in as well? At the moment, it’s not happening.

    1. My Mage.php is recognized in the config of the plugin. I’ve added the example code into my WP template header, to make sure it’s loaded on every page.

      You should put it in index.php of you template file, just above the get_header(); call.

      If I visit my Magento page which is in a subfolder, theoretically I should be recognized as logged in as well? At the moment, it’s not happening.

      It doesn’t follow. You should check your Magento cookie path. If the path is inside that subdirectory where your Magento is, then the parent directory which is your WP instance doesn’t share the same session. If it’s the other way around, meaning your Magento serves as your parent directory and WP is in a subdirectory, then it will work the way you mention.

      How about passing the PHPSESSID from WP (your parent directory) to Magento (subdirectory)? I maybe be unsecured though.

  51. Yes, I’ve tried placing it there. I’ve also experimented putting it in my page.php file above the get_header() call, but still no luck.

    1. You should only have one (1) instance of the code below:
      Mage::getSingleton('core/session', array('name' => 'frontend'));

  52. Including the core/session singleton in the template index.php file doesn’t work, but I can get the Magento session to load in WordPress if I require and initialize Magento in the root index.php file (before the WordPress framework loads). This is very strange, but at least I have a band-aid fix for now. I’ll have to keep adding that code every time I update WordPress, which is very inefficient.

    Any ideas as to how I can add Magento before WordPress Loads without doing it the way I’ve described?

    1. That’s weird. There’s a big chance that you’ll get a ‘Cannot send header information…’ error with that setup. The call for core/session for frontend should only be done once in the template’s index.php. Try removing your ‘band-aid’ fix and check if there’s ‘Mage’ class being instantiated. You can do that by adding the code below to your template file WITHOUT your fix.

      <?php print_r(get_declared_classes()); ?>

      You should see Mage and Varien_Autoload if your plugin setup is correct.

  53. I can confirm that both Mage and Varien_Autoload are present just using Mage Enabler, but it still will not pass the session information unless I include Magento before WordPress is initialized (band-aid).

    I’ve been experimenting putting the Mage launch code at different points in my wp-settings.php file. IT appears that the code works until line 190 (a foreach loop that includes the plugins). This leads me to believe that I have a conflicting plugin. I’ll try deactivating plugins one-by-one to see if I can find the culprit.

    Thanks for your help!

  54. I can confirm that the issue I’m experiencing was a plugin conflict. It appears that WP E-Commerce (our existing cart we’re trying to move away from) is clashing with the Magento code. Thanks again for your help Richard.

    1. Hmm, interesting what could be the cause. I might have to check on that to make sure Mage Enabler compatible with any setup.

  55. Hi,

    We tried to implement this module in a buddypress+magento site (Followed all steps given in documents). But didn’t see any result yet. Do we need any modification in order to use this with a buddypress installation? please help us as


  56. hi,good work, i have a answer, How i show in a post of wordpress a product of magento? i cant see how,maybe i need sleep……

  57. Great work Richard. I’m using this the way it was meant to… WordPress -> Magento and back. looking forward to giving this a try, and hopefully using WP as a fronted for the whole Magento system.

    Thanks again!

  58. Richard,

    I’ve read through all the comments, and do understand about putting the

    Mage::getSingleton(‘core/session’, array(‘name’ => ‘frontend’));

    code in the index.php of the theme. Unfortunately, the site I am working on NEVER hits that page, so it won’t generate the cookie.

    I placed that code block above the get_header() in the page.php file (the default page template for the site). I do see a ‘frontend’ cookie generated, albeit with a period in front of the domain, ie:

    I have created a Magento user with the same credentials as a WP user.

    Then Mage Enabler is installed and seems to be working.

    I’m not getting the correct username after logging in, and am still seeing Welcome Guest.

    Any help would be appreciated!


  59. I’m also seeing this one now…

    Fatal error: Uncaught exception ‘Zend_Controller_Response_Exception’ with message ‘Cannot send headers; headers already sent….

  60. Richard, I’m trying to figure out if your solution is the best one in my case. I want to be able to use any WP plugin and upgrade WP as needed. I also want to be able to upgrade Magento normally. The only thing I need is for the user to not lose the session when moving between magento and wordpress. I dont even really need to have WP use magento’s theme (I will create a WP theme that is similar enough).

    Based on what I read, I take that this plugin IS what I need… Would you please confirm that, based on what my needs are?


  61. @Eddie, with the code supplied it shouldn’t be too difficult to do a Drupal Enabler for Magento. Ask if you need further help.

  62. Hi, great plugin, thanks.

    I can’t seem to get the login working.
    If I have an account setup in magento i.e.
    usr: [email protected]
    pass: xxxx

    When I try to login to wordpress it doesn’t work.

    Also when I login to magento and go to the blog it still says welcome guest.

    I edited the functions file, the user file and the wp-login file as above

    Am I missing something?

  63. We ran into problems using the MageEnabler plugin to retrieve session data, in our case the cart data when a user is not logged in. This does NOT work using MageEnabler (or at least we did something wrong)

    In case you want to display the cart count outside of Magento we did this like Matt Brown mentioned earlier.

    We disabled the MageEnabler plugin and manually loaded the Magento stuff in our WordPress index.php:

    $session = Mage::getSingleton(‘checkout/session’);


    This basically does the same as MageEnabler.

    In your WordPress template get the stuff you want:


    This is with WP 3.1.4 and Magento 1.5.1


  64. My PHP code got messed up. It should read:

    Mage::getSingleton(‘core/session’, array(‘name’=>’frontend’));
    $session = Mage::getSingleton(‘checkout/session’);


    # this gets the items count in your cart
    $cart = Mage::helper(‘checkout/cart’)->getCart()->getItemsCount();

  65. Hi Richard! I really appreciate your work!
    I’ve been trying to make your plugin work on WP 3.2.1 and Magento 1.5.1 but without success. I still don’t get the frontend cookie.

    I have my WP installed in htdocs/wordpress/ and magento in htdocs/wordpress/magento

    If you have time, can you please write the steps we have to do (what files we have to modify and the code) in order to work. You mentioned that some files don’t have to be modified if you install the plugin, but is still confusing.

    I’d really appreciate you help!

  66. Just to add to my message. Would it be a cache thing? I’m running both programs locally with a blog folder inside the main magento folder.
    Should I set the cache system in the configuration in MAgento somehow?

  67. I entered the URL of mage.php and I go this error:

    Fatal error: Cannot redeclare __() (previously declared in /home/italian6/public_html/blogs/wp-includes/l10n.php:96) in /home/italian6/public_html/eStore/app/code/core/Mage/Core/functions.php on line 96

  68. I have a project in development, that has a wordpress site on one domain and a magento site on another domain. When transfering the session over, I append the SID to the URL, and it almost works.

    By almost, I mean this:
    1) You can add items to cart in wordpress, the cookie sessionID stays the same throughout this.
    2) I send the user to the magento site, via a header location, or presenting a link for them to click, with the session ID at the end of the url, such as:
    3) The cart appears empty, and if you pay attention to the cookie id, it has switched at this point.
    4) Refresh the page, by pasting the URL in, and the cart works properly, maintaining the cookie session ID
    5) Now, if you go back to the wordpress site, and add differnt items to the cart, and go back to the magento site, the cart and cookie session ID work as you would expect.

    I can duplicate the issue by purging the cookies in the browser cache. It starts the whole thing over, with the cart appearing empty.

    Have you seen this? I suspect rewrite rules, but cant find the issue yet. Any help would be very appreciated.

  69. we have an existing magento site, and want to create a new storefront for it with different theme, sharing some products but in different categories, and with additional products unique to this store.

    we want to template the front end more like a cms with portfolio etc, and a single link in the wp site to the shop section.

    not quite sure of the question to ask, but generally my query is how would you use this plugin to access mystore2 inside magento instead of the main store?

  70. would you be able to contact me directly via email? I’m having an issue with the wordpress + magento install where enabling the plugin immediately causes a cascade of errata in the footer section of the site, and it’s a bit large to be pasting in here.

    wordpress is installed in the docroot, magento is installed as a 2nd storefront in a shop/ subdomain (

    as soon as mage-enabler was enabled and configured, the footers disappeared. I had to turn on wp_debug to see what was going on, and it was a bit more than I had expected.

  71. Hello Richard, I wrote posted to you already. I followed your instructions in this article, everything seems fine, but the welcome guest does not appear on the homepage.

  72. hola termine mi tienda magento ahora estoy intentando colocarle en wordpress solo que esta corriendo desde xamppin , mi pregunta es si con tu plugin yo prodria integrarla a wordpress

  73. Hello,

    I have had a WP blog for some time now. I use it more like a website than a blog.

    I want to put my magento product into my wordpress page. Will this plugin do this?

    I want all the checkout and everything to be done in a wordpress page. All I want from magento is the functionality of it’s e-commerce onto my wordpress website.

    – Limar

  74. Hello Richard!

    Thank you for your prompt response!

    Do you by any chance offer a service to have this done on my website? I have only one product with different variations that I would like to add onto 1 wordpress page.

    Evidently what I want to do is just be able to ‘add to cart’, when added then you get redirected to checkout within a wordpress page.

    Your help will greatly be appreciated as you sound like an experienced programmer!

  75. Hi Richard – is it possible to inherit the object and variable scope for phtml files referenced from within WP?

    (e.g., ‘$_cartQty = $this->getSummaryCount()’ in the magento cart phtml)

    I can call phtml files (static) and can get the magento cart/session data separately, but would like to avoid recreating the phtml from scratch (and maintaining two identical header pieces) in order to display the same ‘my cart’ piece in both the magento and WP headers.


  76. Hey Richard thanks for the quick response!

    Sure – so trying to re-use same phtml files from magento header in WP and I can get a ‘myaccount’ phtml from magento to show in WP with variables like username carried over:

    Mage::getSingleton(‘core/session’, array(‘name’=>’frontend’));
    $layout = Mage::getSingleton(‘core/layout’);
    $myaccountBlock = $layout->createBlock(‘page/html_header’)->setTemplate(‘page/html/myaccount.phtml’)->toHtml();


    ..but when doing the same with the cart phtml the quantity is always ‘0’ on the WP side:

    $carttest = Mage::getSingleton(‘core/cart’);

    $mycartBlock = $layout->createBlock(‘page/html_header’)->setTemplate(‘checkout/cart/cartheader.phtml’)->toHtml();


    Am I missing a getSingleton or helper call to get the cart quantity to show on the WP side?

    Let me know if that makes sense and thanks again!

  77. Hey Richard – got it worked out (pbkac):

    $mycartBlock = $app->getLayout()->getBlockSingleton(‘checkout/cart_sidebar’)->setTemplate(“checkout/cart/cartheader.phtml”)->toHtml();

    Thanks again though!

  78. Hello Richard, I installed your plugin and followed your guide step by step. I find the cookie “frontend” but if I try to login the message is always “Welcome Guest.” Username (email) and password are the same on wordpress and magento. I use WP 3.4 and Magento 1.7 . Thanks for answer

  79. I resolved: add this line $ session-> setCustomerAsLoggedIn ($ session-> GetCustomer ()); in user.php after $ session = Mage :: getSingleton (‘customer / session’). Why not open the session on Magento?

  80. I have installed Mage Enabler, my project deployment is like Magento is installed in and wordpress in, currently in this setup when i try to access the magento session im not able to get the customer session value on wordpress.

    I can see only Welcome Guest

    But when i deploy the project like magento on and wordpress on . then i’m successfully able to get the session value.

    I can see message as Welcome User[user of magento]

    Can you explain whether in the first setup will the mage enabler work if so please let me know what should alter

    1. Hello Keerthi,

      The answer to your question is the availability of the Magento cookie. The reason why the setup where Magento is installed in works because the Magento cookie is available to ALL directories under (which includes and where as when it is installed in, it is only available to those directories within Check the cookie domain and path in the admin settings for more info.

      Thanks for dropping by.

  81. Thanks Richard for the reply, Now my doubt is clear. If you could guide me on what type of settings if i could make change in the cookie domain & path, it would be helpful for me.

    I tried on those settings i’m quiet unsuccessful.

  82. hi Richard,

    first of all this is an amazing plugin 🙂 thanks for creating such a great thing.

    here i want to integrate wordpress with the magento (i installed the magento as a subdirectory inside the wordpress folder). i have followed all the instructions you mentioned in the posts. i can see frontend cookie. but my problem is the site is showing only “welcome guest” note (it doesnt change when i logged in or not). i have used same username and password for the admin side of the wordpress as well as magento. please let me know what is my issue.

    (also i have made the changes in the index.php, wp-login.php and the users.php).

  83. Thanks for your response Richard,

    i am just a newcomer in this field. so could you please guide me where i can find the Magento cookie domain path ? do you mean the absolute URL setting in the plugin’s admin side? should i need to edit any other files?

    please advise me..

  84. We are getting an Invalid URL error when entering the Mage.php path. We have entered the full & correct path, taking note of case sensitivity, yet we are still getting this error

    Any ideas. It is a Plesk server managed by ourselves.

  85. When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I
    get four emails with the same comment. Is there any way you can
    remove me from that service? Many thanks!

Leave a Reply