关于unctions.php的警告/注意

时间:2013-05-01 作者:Ada

我对主页顶部显示的通知有疑问,如:

注意事项:load_plugin_textdomain 调用时使用的参数自2.7版以来已被弃用,没有可用的替代参数。在里面.../wordpress/wp-includes/functions.php 在线2925

这行代码是关于$wpsmiliestrans:

\';)\' => \'icon_wink.gif\',
如果我删除这段代码,它将在第2924行显示问题,这是关于笑脸的另一段代码,这类代码有几十种。我怎样才能摆脱这个
我已将软件更新到最新版本。

1 个回复
SO网友:fuxia

\';)\' => \'icon_wink.gif\', 在当前版本的第2477行中,除非您知道如何运行WordPress的私有分支,否则您永远不应该只更改或删除核心文件。

第2925行是第二行trigger_error() 在此功能中:

function _deprecated_argument( $function, $version, $message = null ) {

    do_action( \'deprecated_argument_run\', $function, $message, $version );

    // Allow plugin to filter the output error trigger
    if ( WP_DEBUG && apply_filters( \'deprecated_argument_trigger_error\', true ) ) {
        if ( ! is_null( $message ) )
            trigger_error( sprintf( __(\'%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s\'), $function, $version, $message ) );
        else
            trigger_error( sprintf( __(\'%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.\'), $function, $version ) );
    }
}
那只是通知的地方,而不是你犯错的地方。

让我们看看load_plugin_textdomain(); 真正的问题是:

/**
 * Loads the plugin\'s translated strings.
 *
 * If the path is not given then it will be the root of the plugin directory.
 * The .mo file should be named based on the domain with a dash, and then the locale exactly.
 *
 * @since 1.5.0
 *
 * @param string $domain Unique identifier for retrieving translated strings
 * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder,
 *  where the .mo file resides. Deprecated, but still functional until 2.7
 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precedence over $abs_rel_path
 */
function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false ) {
    $locale = apply_filters( \'plugin_locale\', get_locale(), $domain );

    if ( false !== $plugin_rel_path ) {
        $path = WP_PLUGIN_DIR . \'/\' . trim( $plugin_rel_path, \'/\' );
    } else if ( false !== $abs_rel_path ) {
        _deprecated_argument( __FUNCTION__, \'2.7\' );
        $path = ABSPATH . trim( $abs_rel_path, \'/\' );
    } else {
        $path = WP_PLUGIN_DIR;
    }

    $mofile = $path . \'/\'. $domain . \'-\' . $locale . \'.mo\';
    return load_textdomain( $domain, $mofile );
}
您收到的错误消息可以翻译为:

插件正在使用load_plugin_textdomain() 然后就过去了not false 作为该函数的第二个参数。

该插件比当前标准落后五年。

解决方案禁用所有插件

结束