Skip to content
Advertisement

Function get_plugins() cannot be execute

I’m trying to code simple php script which will return all plugins of WordPress.

My code:

JavaScript

And my output is:

JavaScript

I used official example from: https://codex.wordpress.org/Function_Reference/get_plugins

I did:

  • change of PHP version from 7.2 to 5.6
  • set right permission of files
  • install WordPres once again

So my wordpress is totally fresh and I still have the same error. Somebody knows how to solve it?

Advertisement

Answer

To load all the WordPress functions you need to include the file wp-load.php:

require_once("../../../../wp-load.php");

and not the plugins one.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement