Magento 2 WordPress Integration Root Documentation

  • Installation

    You can install the module for Magento 2 using Composer or you can manually install it using FTP.

    Composer

    Run the following commands in your Magento 2 root directory to install the module using Composer.

    # Add the FishPig Composer repo
    composer config repositories.fishpig composer https://repo.fishpig.com/
    
    # Install the module using Composer
    composer require fishpig/magento2-wordpress-integration-root:*
    
    # Enable the module in Magento 2
    php bin/magento module:enable FishPig_WordPress_Root
    
    # Run the Magento upgrade system
    php bin/magento setup:upgrade
    Manual

    You can download the latest version of the module by logging in to your account and selecting Account > Projects.

    Extract the ZIP file and upload the files to your Magento site at the directory below:

    app/code/FishPig/WordPress_Root

    When creating the folders, ensure you use the correct capitalisation.

    To complete the installation, run the following commands in a terminal.

    # Enable the module in Magento 2
    bin/magento module:enable FishPig_WordPress_Root
    
    # Run the Magento upgrade system
    bin/magento setup:upgrade

    ↑ Back to Top

  • Configuration

    Once the module is installed, you need to make some small WordPress configuration changes.

    WordPress URLs

    Next you need to change the WordPress home URL to be the base URL of your Magento store. To do this, login to the WordPress Admin and select Settings > General. You should see 2 URL fields. Change the second field to your Magento store's base URL.

    Settings WordPress URLs for use with Root

    To finish the configuration, open your wp-config.php file and find the WP_DEBUG line and add the following below it:

    define('COOKIEPATH', '/'); // Add this below the WP_DEBUG line
    

    While it's useful to remove /blog/ (or whatever your blog URL is) from some URLs, it's useful to keep it for your default posts. To do this, select Settings', 'Permalinks in the WordPress Admin and add /blog/ to the permalink structure (eg. /blog/%postname%/).

    Adding /blog/ back into permalinks

    Create a Default Post List Page (blog/)

    If you add /blog/ back in to your default blog posts, you will want to create a /blog/ page to list all of your blog posts. This is the page that is the standard WordPress homepage and probably was your blog homepage before installing Root. To do this, first create a WordPress page and then select this page from the drop down at Settings > Reading > Your homepage displays > A static page > Posts Page.

    Replace the Magento Homepage

    To replace the Magento homepage with a page created in WordPress, create a new page in WordPress, publish it and then select it from the dropdown at Settings > Reading > Your homepage displays > A Static page > Homepage.

    ↑ Back to Top