个性化阅读
专注于IT技术分析

出现wordpress错误:无法修改标题信息

点击下载

尝试激活主题或尝试保存帖子时出现此错误(我激活了wp-debug):

警告:无法修改标头信息-已在/ mnt / webv /中发送过标头(输出始于/mnt/webv/b3/13/56920413/htdocs/WordPress_02/wp-content/themes/BackpackFamily/functions.php:58)第197行的b3 / 13/56920413 / htdocs / WordPress_02 / wp-admin / post.php警告:无法修改标头信息-已发送的标头(输出始于/ mnt / webv / b3 / 13/56920413 / htdocs / WordPress_02 /第1171行的/mnt/webv/b3/13/56920413/htdocs/WordPress_02/wp-includes/pluggable.php中的wp-content / themes / BackpackFamily / functions.php:58)

那是我的functions.php的代码, 我做错了什么?

<?php

// Navigation

    if ( function_exists('register_nav_menus') ) {
        register_nav_menus(array(
            'main-navi' => __( 'Hauptnavigation' )
        ));
    }

// Thumbnails

    if ( function_exists( 'add_theme_support' ) )
        add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 200, 200, true );


// Read more Link

   function new_excerpt_more($more) {
       global $post;
       return ' … </br><a href="'. get_permalink($post->ID) . '">' . 'Mehr lesen &raquo;' . '</a>';
   }
   add_filter('excerpt_more', 'new_excerpt_more');



// Sidebar

    function sl_sidebar() {
        $args = array(
            'id'            => 'default_sidebar', 'name'          => __( 'Sidebar Header', 'text_domain' ), 'description'   => __( 'Sidebar Header', 'text_domain' ), 'before_title'  => '<h3><a href="#">', 'after_title'   => '</a></h3>', 'before_widget' => '', 'after_widget'  => '', );
        register_sidebar( $args );
    }

    add_action( 'widgets_init', 'sl_sidebar' );

// Search Button

    add_filter('get_search_form', 'new_search_button');
    function new_search_button($text) {
        $text = str_replace('value="Suche"', 'value="Suchen"', $text);
        return $text;
    }
?>

感谢帮助!


#1


根据你的评论, 该通知将引发你的functions.php文件的最后一行。

这使我相信, 你的文件中可能在php标记之外(之前, 之后或之间)(<?php和?>)之外的文件中有错行换行和/或空格

删除末尾的php标记?>-现在是WordPress建议的代码样式, 以省略php的标记。

另外, 请确保在打开<?php标签之前没有杂线换行。

旁注:

这是一条通知, 不是真正的错误。如果你关闭了调试功能, 那将是没有问题的, 因为通知将被静默。

但…

在将WP_DEBUG设置为true的情况下测试代码非常感谢你。这是确保代码运行时不另行通知的唯一方法!


#2


我建议你也阅读提供的链接, 以便大致了解此错误。它也可能会解决你的问题。

修复标题错误:https://stackoverflow.com/a/8028987/4205975


#3


我认为在文件functions.php的最后一行有一些空格字符, 你应该删除该文件的last?>。

赞(0)
未经允许不得转载:srcmini » 出现wordpress错误:无法修改标题信息

评论 抢沙发

评论前必须登录!