最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

The XXX plugin has been deactivated due to an error: The plugin does not have a valid header

programmeradmin0浏览0评论


I have build an app which, amongst other stuff deals with plugins for multiple WP sites.

I copy plugin folders & files from the "master" app into the wp-content/plugins folder of a freshly created WP site with just the bare wp_options:
- Copy of the folders & files runs properly, with chmod at 0755 for folders & 0644 for files, to mimick the standard akismet plugin install ;

  • serialize the plugin data & update the 'active_plugins' field with it, and the serialized data is well formed:

a:4:{i:0;s:14:"classic-editor";i:1;s:17:"increase_rest_get";i:2;s:34:"jwt-authentication-for-wp-rest-api";i:3;s:17:"myDashboardWidget";}

array (
0 => 'classic-editor',
1 => 'increase_rest_get',  
2 => 'jwt-authentication-for-wp-rest-api',  
3 => 'myDashboardWidget',
)

But, when I go to the admin, I get the below, All the activated plugins are deactivated:


Why is this ? Am I missing something in the activation / copying process ?
Many thanks,
JM


I have build an app which, amongst other stuff deals with plugins for multiple WP sites.

I copy plugin folders & files from the "master" app into the wp-content/plugins folder of a freshly created WP site with just the bare wp_options:
- Copy of the folders & files runs properly, with chmod at 0755 for folders & 0644 for files, to mimick the standard akismet plugin install ;

  • serialize the plugin data & update the 'active_plugins' field with it, and the serialized data is well formed:

a:4:{i:0;s:14:"classic-editor";i:1;s:17:"increase_rest_get";i:2;s:34:"jwt-authentication-for-wp-rest-api";i:3;s:17:"myDashboardWidget";}

array (
0 => 'classic-editor',
1 => 'increase_rest_get',  
2 => 'jwt-authentication-for-wp-rest-api',  
3 => 'myDashboardWidget',
)

But, when I go to the admin, I get the below, All the activated plugins are deactivated:


Why is this ? Am I missing something in the activation / copying process ?
Many thanks,
JM

Share Improve this question asked Feb 20, 2020 at 17:51 JMBJMB 238 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The active_plugins data is incorrect. Here's a sample from one of my test sites:

a:3:{i:0;s:34:"advanced-custom-fields-pro/acf.php";i:4;s:31:"code-snippets/code-snippets.php";i:21;s:24:"wordpress-seo/wp-seo.php";}

Or:

Array
(
    [0] => advanced-custom-fields-pro/acf.php
    [4] => code-snippets/code-snippets.php
    [21] => wordpress-seo/wp-seo.php
)

Notice that the plugins are referred to by the path to the main plugin file, relative to the plugins folder. The main plugin folder is what contains the plugin header (example from here):

/**
 * Plugin Name:       My Basics Plugin
 * Plugin URI:        https://example/plugins/the-basics/
 * Description:       Handle the basics with this plugin.
 * Version:           1.10.3
 * Requires at least: 5.2
 * Requires PHP:      7.2
 * Author:            John Smith
 * Author URI:        https://author.example/
 * License:           GPL v2 or later
 * License URI:       https://www.gnu/licenses/gpl-2.0.html
 * Text Domain:       my-basics-plugin
 * Domain Path:       /languages
 */

Since /wp-content/plugins/classic-editor is a directory, not a file, it doesn't have a plugin header, so gets deactivated.

发布评论

评论列表(0)

  1. 暂无评论