• My site was running very slowly, so I decided to try deactivating plugins to see if it would help. I deactivated WordPress SEO by accident – I suspected a different plugin, and meant to deactivate that one. However, the site sped up immediately (a lot), so it did seem that WordPress SEO had been the problem.

    When I tried to reactivate it to confirm that activation would reproduce the slowdown, I got the following error message:

    Plugin could not be activated because it triggered a fatal error

    Fatal error: Cannot use object of type WP_Error as array in home/(username)/public_html/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php on line 136

    This is way over my head, so I have no idea whether it indicates a problem with the plugin or with my webhost (which recently migrated me to a new server), but I’m hoping you can tell me…

    https://www.ads-software.com/extend/plugins/wordpress-seo/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I also get this error. Activated 1.2.8.4. Saw that 1.2.8.5 was released. Deactivated the old plugin. Replaced it with 1.2.8.5 and now get a fatal error when trying to activate.

    EDIT: I tried to activate it a second time, and now it works. Go figure…

    Thread Starter mihansa

    (@mihansa)

    The update also corrected the problem for me.

    I also wanted to note that the speedup I experienced when I first deactivated WordPress SEO did not last. A little later, my site was loading just as slowly with the plugin deactivated, and is working pretty speedily now that I have reactivated the updated version, so it does not seem to be the cause of my slowdown issues.

    Here is the solution :
    Change the content of wp-seo.php with this

    <?php
    /*
    Plugin Name: WordPress SEO
    Version: 1.4.7
    Plugin URI: https://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin
    Description: The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.
    Author: Joost de Valk
    Author URI: https://yoast.com/
    License: GPL v3
    
    WordPress SEO Plugin
    Copyright (C) 2008-2013, Joost de Valk - [email protected]
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
    */
    /**
     * @package Main
     */
    
    if ( !defined( 'DB_NAME' ) ) {
    	header( 'HTTP/1.0 403 Forbidden' );
    	die;
    }
    
    if ( !defined( 'WPSEO_UPLOAD_DIR' ) )
    	define( 'WPSEO_UPLOAD_DIR', plugin_dir_path(__FILE__) );
    if ( !defined( 'WPSEO_UPLOAD_URL' ) )
    	define( 'WPSEO_UPLOAD_URL', plugin_dir_url(__FILE__) );
    if ( !defined( 'WPSEO_URL' ) )
    	define( 'WPSEO_URL', plugin_dir_url( __FILE__ ) );
    if ( !defined( 'WPSEO_PATH' ) )
    	define( 'WPSEO_PATH', plugin_dir_path( __FILE__ ) );
    if ( !defined( 'WPSEO_BASENAME' ) )
    	define( 'WPSEO_BASENAME', plugin_basename( __FILE__ ) );
    
    define( 'WPSEO_FILE', __FILE__ );
    
    load_plugin_textdomain( 'wordpress-seo', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    
    if ( version_compare( PHP_VERSION, '5.2', '<' ) ) {
    	if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ) {
    		require_once ABSPATH . '/wp-admin/includes/plugin.php';
    		deactivate_plugins( __FILE__ );
    		wp_die( sprintf( __( 'WordPress SEO requires PHP 5.2 or higher, as does WordPress 3.2 and higher. The plugin has now disabled itself. For more info, %s$1see this post%s$2.', 'wordpress-seo' ), '<a href="https://yoast.com/requires-php-52/">', '</a>' ) );
    	} else {
    		return;
    	}
    }
    
    define( 'WPSEO_VERSION', '1.4.7' );
    
    $pluginurl = plugin_dir_url( __FILE__ );
    if ( preg_match( '/^https/', $pluginurl ) && !preg_match( '/^https/', get_bloginfo( 'url' ) ) )
    	$pluginurl = preg_replace( '/^https/', 'http', $pluginurl );
    define( 'WPSEO_FRONT_URL', $pluginurl );
    unset( $pluginurl );
    
    function wpseo_init() {
    	require WPSEO_PATH . 'inc/wpseo-functions.php';
    
    	$options = get_wpseo_options();
    
    	if ( isset( $options['stripcategorybase'] ) && $options['stripcategorybase'] )
    		require WPSEO_PATH . 'inc/class-rewrite.php';
    
    	if ( isset( $options['enablexmlsitemap'] ) && $options['enablexmlsitemap'] )
    		require WPSEO_PATH . 'inc/class-sitemaps.php';
    }
    
    /**
     * Used to load the required files on the plugins_loaded hook, instead of immediately.
     */
    function wpseo_frontend_init() {
    	$options = get_wpseo_options();
    	require WPSEO_PATH . 'frontend/class-frontend.php';
    	if ( isset( $options['breadcrumbs-enable'] ) && $options['breadcrumbs-enable'] )
    		require WPSEO_PATH . 'frontend/class-breadcrumbs.php';
    	if ( isset( $options['twitter'] ) && $options['twitter'] )
    		require WPSEO_PATH . 'frontend/class-twitter.php';
    	if ( isset( $options['opengraph'] ) && $options['opengraph'] )
    		require WPSEO_PATH . 'frontend/class-opengraph.php';
    }
    
    /**
     * Used to load the required files on the plugins_loaded hook, instead of immediately.
     */
    function wpseo_admin_init() {
    	$options = get_wpseo_options();
    	if ( isset( $_GET['wpseo_restart_tour'] ) ) {
    		unset( $options['ignore_tour'] );
    		update_option( 'wpseo', $options );
    	}
    
    	if ( isset( $options['yoast_tracking'] ) && $options['yoast_tracking'] ) {
    		require WPSEO_PATH . 'admin/class-tracking.php';
    	}
    
    	require WPSEO_PATH . 'admin/class-admin.php';
    
    	global $pagenow;
    	if ( in_array( $pagenow, array( 'edit.php', 'post.php', 'post-new.php' ) ) ) {
    		require WPSEO_PATH . 'admin/class-metabox.php';
    		if ( isset( $options['opengraph'] ) && $options['opengraph'] )
    			require WPSEO_PATH . 'admin/class-opengraph-admin.php';
    	}
    
    	if ( in_array( $pagenow, array( 'edit-tags.php' ) ) )
    		require WPSEO_PATH . 'admin/class-taxonomy.php';
    
    	if ( in_array( $pagenow, array( 'admin.php' ) ) )
    		require WPSEO_PATH . 'admin/class-config.php';
    
    	if ( !isset( $options['yoast_tracking'] ) || ( !isset( $options['ignore_tour'] ) || !$options['ignore_tour'] ) )
    		require WPSEO_PATH . 'admin/class-pointers.php';
    
    	if ( isset( $options['enablexmlsitemap'] ) && $options['enablexmlsitemap'] )
    		require WPSEO_PATH . 'admin/class-sitemaps-admin.php';
    }
    
    add_action( 'plugins_loaded', 'wpseo_init', 14 );
    
    if ( !defined( 'DOING_AJAX' ) || !DOING_AJAX )
    	require WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    
    if ( is_admin() ) {
    	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
    		require WPSEO_PATH . 'admin/ajax.php';
    	} else {
    		add_action( 'plugins_loaded', 'wpseo_admin_init', 15 );
    	}
    
    	register_activation_hook( __FILE__, 'wpseo_activate' );
    	register_deactivation_hook( __FILE__, 'wpseo_deactivate' );
    } else {
    	add_action( 'plugins_loaded', 'wpseo_frontend_init', 15 );
    }
    unset( $options );

    Enjoy

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Fatal error when trying to reactivate’ is closed to new replies.