【发布时间】:2016-06-15 07:57:24
【问题描述】:
将项目迁移到其他服务器后,我遇到了问题。当我转到 /wp-admin 时,我得到一个“白屏死机”。如果我改为访问 /wp-login.php,我会得到登录表单,但会提供建议
错误:Cookie 被您的浏览器阻止或不支持。你 必须启用 cookie 才能使用 WordPress。
显然我的浏览器没问题,我在其他电脑上试过
我浪费了几个小时寻找错误,最后我评论了这些行......
<?php
function portfolio_custombox($post) {
$stored_id = get_post_meta( $post->ID, 'pageid_destino', true);
?>
<div class="settBlock"><label for="page_color_scheme">
<input type="number" class="" value="<?php echo $stored_id ?>" for="pageid_destino" name="pageid_destino"><br>
<label for="pageid_destino"><?php _e('Id de la página destino (este número es el que se presenta después del argumento ?post=<b>number</b>)', MY_THEME); ?></label>
<?php } ?>
<?php
function portfolio_addmetaboxes() {
$postypes = array('hgr_portfolio');
foreach ( $postypes as $posttype ) {
add_meta_box(
'pageid_destino',
__( 'ID de Página Destino', MY_THEME ),
'portfolio_custombox',
$posttype,
'normal',
'high'
);
}
}
add_action( 'add_meta_boxes', 'portfolio_addmetaboxes' );
function portfolio_savemetabox($post_id)
{
if ( ! isset( $_POST['pageid_destino'] ) ) {
return $post_id;
}
$pageid_destino = sanitize_text_field( $_POST['pageid_destino']);
update_post_meta($post_id, 'pageid_destino', $pageid_destino );
}
add_action( 'save_post', 'portfolio_savemetabox' );
在评论这些行之后,我的登录正在恢复......但是......为什么?
以及为什么在我的本地环境和以前的主机中没有发生这种情况
提前致谢
更新
将 WP_DEBUG 设置为 true 后,我收到此错误...
警告:无法修改标头信息 - 标头已由 (输出开始于 /home/my/staging/1/wp-content/themes/attractor-child/functions_includes/functions.metaboxes.php:12) 在 /home/my/staging/1/wp-content/themes/attractor/highgrade/framework/core/newsflash.php 在第 72 行
【问题讨论】:
标签: wordpress wordpress-theming hook