Adding Wordpress within Slim 3

I’ve seen it asked here a couple of times with no answer, but here it goes.

I have built an web app using Slim 3 and I also built a simple blog for the site, but now it’s time to upgrade. I was hoping to use Wordpress, but I can’t find a way to include Wordpress within Slim 3 without doing some major re-writes and I’ll still likely lose the CMS - big reason for wanting to use Wordpress.

I would rather not use a subdomain. Any help would be appreciated.

You can’t include wordpress in Slim…

You can access the wp functions and basically recreate the site, but you lose wp base paths, which breaks plugins and other wp features.

What exactly are you trying to accomplish? You can setup your webserver to server the blog on a /blog path and Slim to catch all other paths. Otherwise you can also use the WordPress REST API and get data from WordPress into Slim.

I’m want to have a blog for my website that would allow me to easily update/insert new blog topics, SEO handling, CMS and basically all of the other convenient features that Wordpress allows.

I initially started by just adding /blog path to my root directory, but I have key data within slim’s index.php (session information, login info, user info, etc.) that I would like to access. I know I can just re-write the code within a PHP plugin, but that would take a lot of time and I was wondering if there was another option.

Seems you want to access your wordpress together with your slim.

Yes you can do this:

  1. you have to create your own plugin to make an API to your wordpress
  2. then you can directly access your blog from your slim app using plugin API you have created.

This will safe to your wordpress,

Don’t do remote, grabbing, or scrapping because could break your wordpress security.

You can bridge a WordPress install with your Slim application. I built the following site (https://www.choosegeminicleaning.com/) using Slim, Twig and WordPress to handle the content. Including WordPress wp-load file within my Slim application opened WP functionality to Slim. I produced functions within Slim to handle plugin functionality within Slim. This also allowed me to isolate plugin js and css files to specific pages eliminating overall site bloat.

Slim routes are produced within wp_query