资金新闻php错误

时间:2017-07-24 21:53:27

标签: php

您好我需要帮助解决这个PHP代码。我收到错误: 解析错误:语法错误,第3行/home/pkyxkrtp/public_html/wp-content/themes/fundingpress/themeOptions/rating.php中的意外'}'

<?php
}
add_action( 'save_post', 'cd_meta_box_save' );
function cd_meta_box_save( $post_id ){
  // Bail if we're doing an auto save
  if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
  // if our nonce isn't there, or we can't verify it, bail
  if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
  // if our current user can't edit this post, bail
  if( !current_user_can( 'edit_post' ) ) return;
  // now we can actually save the data
  $allowed = array(
    'a' => array(
      // on allow a tags
      'href' => array()
      // and those anchords can only have href attribute
    )
  );
  // Probably a good idea to make sure your data is set
  if( isset( $_POST['creteria_1_text'] ) )
    update_post_meta( $post_id, 'creteria_1_text', wp_kses( $_POST['creteria_1_text'], $allowed ) );
  if( isset( $_POST['overall_rating'] ) )
    update_post_meta( $post_id, 'overall_rating', esc_attr( $_POST['overall_rating'] ) );
  if( isset( $_POST['creteria_1'] ) )
    update_post_meta( $post_id, 'creteria_1', esc_attr( $_POST['creteria_1'] ) );
  if( isset( $_POST['creteria_2_text'] ) )
    update_post_meta( $post_id, 'creteria_2_text', wp_kses( $_POST['creteria_2_text'], $allowed ) );
  if( isset( $_POST['creteria_2'] ) )
    update_post_meta( $post_id, 'creteria_2', esc_attr( $_POST['creteria_2'] ) );
  if( isset( $_POST['creteria_3_text'] ) )
    update_post_meta( $post_id, 'creteria_3_text', wp_kses( $_POST['creteria_3_text'], $allowed ) );
  if( isset( $_POST['creteria_3'] ) )
    update_post_meta( $post_id, 'creteria_3', esc_attr( $_POST['creteria_3'] ) );
  if( isset( $_POST['creteria_4_text'] ) )
    update_post_meta( $post_id, 'creteria_4_text', wp_kses( $_POST['creteria_4_text'], $allowed ) );
  if( isset( $_POST['creteria_4'] ) )
    update_post_meta( $post_id, 'creteria_4', esc_attr( $_POST['creteria_4'] ) );
  if( isset( $_POST['creteria_5_text'] ) )
    update_post_meta( $post_id, 'creteria_5_text', wp_kses( $_POST['creteria_5_text'], $allowed ) );
  if( isset( $_POST['creteria_5'] ) )
    update_post_meta( $post_id, 'creteria_5', esc_attr( $_POST['creteria_5'] ) );
}
// function for show rating content
//$key_1_value = get_post_meta($post->ID, 'my_meta_box_text', true);
?>

1 个答案:

答案 0 :(得分:0)

第一个}add_action( 'save_post', 'cd_meta_box_save' );之前)可能是造成问题的原因