1

I'm using Composer to install plugins with the wpackagist repository. I've added all the relevant lines to my composer.json file in my main wp/ directory.

The plugin installed as expected (it's this one if it makes any difference) to its own folder within wp/plugins/.

The issue that I see now is that it doesn't show up in the plugins section of my WordPress dashboard, nor am I able to install it with wp plugin activate <name>.

Is there something else that needs to be done with Composer or elsewhere in this process to allow the plugin to be able to be installed?

Here's my composer.json:

{
  "name": "johnpbloch/wordpress-core",
  "description": "WordPress is web software you can use to create a beautiful website or blog.",
  "repositories":[
    {
        "type":"composer",
        "url":"https://wpackagist.org"
    }
  ],
  "keywords": [
    "wordpress",
    "blog",
    "cms"
  ],
  "type": "wordpress-core",
  "homepage": "http://wordpress.org/",
  "license": "GPL-2.0+",
  "authors": [
    {
      "name": "WordPress Community",
      "homepage": "http://wordpress.org/about/"
    }
  ],
  "support": {
    "issues": "http://core.trac.wordpress.org/",
    "forum": "http://wordpress.org/support/",
    "wiki": "http://codex.wordpress.org/",
    "irc": "irc://irc.freenode.net/wordpress",
    "source": "http://core.trac.wordpress.org/browser"
  },
  "require": {
    "php": ">=5.3.2",
    "wpackagist-plugin/members": "2.0.2"
  },
  "provide": {
    "wordpress/core-implementation": "4.8.2"
  }
}

As I mentioned, the plugin is visible in my wp-plugins folder, so it seems to have done everything correctly. I just can't manage to install it neither with WP-CLI nor within the WP Dashboard.

2
  • Is the wp-folder equivalent to the wp-content-folder in which the plugins-folder usually resides? can you share your composer.json for more insight? Nov 15, 2017 at 21:04
  • @websupporter wp folder is the top-level folder containing all of the WordPress core files as well as folders like wp-content.
    – AKor
    Nov 15, 2017 at 21:17

2 Answers 2

2

In order for WordPress to recognize a plugin it needs to be in the correct plugins folder.

In an usual installation this is wp-content/plugins/

If you use wpackagist.org, a working example would be this composer.json:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "wpackagist-plugin/broken-link-checker": "*",
    "wpackagist-theme/twentyseventeen": "*"
  }
}

wpackagist-plugin signals its a WordPress plugin you want to install wpackagist-theme signals, its a theme.

I hope, this helps.

If you want to manage your whole installation (including WordPress), I suggest you have a look into WPStarter

Edit:

I tested your composer.json like this:

In the folder, where I have my composer.json I run

wp core download wp config create ... wp core install ... composer install

and it was working for me. My guess was maybe file rights. Could it be, the directory is not readable for the PHP instance?

4
  • I've just added my composer.json file. It seems to have all installed correctly and the plugin folder is right where expected at wp-content/plugins/. I just can't activate it neither with WP-CLI or in the dashboard.
    – AKor
    Nov 15, 2017 at 21:40
  • @Akor updated my answer. suspecting right now file rights. The composer.json worked in my tests. Nov 15, 2017 at 21:58
  • Figured out the issue. I'm using a boilerplate called Bedrock and it seems I was using the wrong composer.json. I used the root-level one and everything worked fine! Thanks.
    – AKor
    Nov 17, 2017 at 17:56
  • Glad to hear :) Nov 17, 2017 at 20:24
0

Thing is, this is not your composer.json, this is the composer.json of johnpbloch/wordpress-core – which is not supposed to be used as a base for your own project, but as a dependency instead.

Better have a look at roots/bedrock and start your project with it. Or more minimalistic with wodby/wordpress-composer. You could also try it with the sample composer.json on the https://wpackagist.org/ front-page, but then you also have to build some more logic around it on your own – as of where exactly you want these packages to be installed to, in which directory.

wp/plugins/ isn't actually the default folder where plugins should be installed to. So you either need to make WordPress recognize this folder as plugin directory or you should install them into their default directory wp-content/plugins/.


However, what's really missing in your question is: What plugin exactly? What command did you run exactly? And what was the output when you run wp plugin activate NAME? What does "I just can't manage to install" mean?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.