رفتن به مطلب

مشکل با ذخیره متاباکس


پست های پیشنهاد شده

سلام دوستان . یک متاباکس دارم با حدود 21 تا چک باکس . 

وقتی 2 تا از چک باکس هارو میزنم خوب ذخیره میشن . 

ولی وقتی تعداد زیادی رو تیک میزنم و بروزرسانی پست رو میزنم ، صفحه به لیست همه پست ها منتقل میشه و پست سیو نمیشه . 

مشکل چیه ؟

<?php
add_action( 'add_meta_boxes', 'add_custom_box' );

    function add_custom_box( $post ) {
        add_meta_box(
            'Meta Box', // ID, should be a string.
            'ژانر فیلم یا سریال ( لطفا ژانر های مرتبط را تیک بزنید )', // Meta Box Title.
            'people_meta_box', // Your call back function, this is where your form field will go.
            'post', // The post type you want this to show up on, can be post, page, or custom post type.
            'side', // The placement of your meta box, can be normal or side.
            'core' // The priority in which this will be displayed.
        );
}
 function people_meta_box($post) {
    wp_nonce_field( 'my_awesome_nonce', 'awesome_nonce' );    
    $checkboxMeta = get_post_meta( $post->ID );
    ?>

    <input type="checkbox" name="ejtemai" id="ejtemai" value="yes" <?php if ( isset ( $checkboxMeta['ejtemai'] ) ) checked( $checkboxMeta['ejtemai'][0], 'اجتماعی' ); ?> />اجتماعی<br />
    <input type="checkbox" name="asrar" id="asrar" value="yes" <?php if ( isset ( $checkboxMeta['asrar'] ) ) checked( $checkboxMeta['asrar'][0], 'اسرارآمیز' ); ?> />اسرارآمیز<br />
    <input type="checkbox" name="action" id="action" value="yes" <?php if ( isset ( $checkboxMeta['action'] ) ) checked( $checkboxMeta['action'][0], 'اکشن' ); ?> />اکشن<br />
<input type="checkbox" name="anime" id="anime" value="yes" <?php if ( isset ( $checkboxMeta['anime'] ) ) checked( $checkboxMeta['anime'][0], 'انیمیشن' ); ?> />انیمیشن<br />
<input type="checkbox" name="bio" id="bio" value="yes" <?php if ( isset ( $checkboxMeta['bio'] ) ) checked( $checkboxMeta['bio'][0], 'بیوگرافی' ); ?> />بیوگرافی<br />
<input type="checkbox" name="tari" id="tari" value="yes" <?php if ( isset ( $checkboxMeta['tari'] ) ) checked( $checkboxMeta['tari'][0], 'تاریخی' ); ?> />تاریخی<br />
<input type="checkbox" name="takh" id="takh" value="yes" <?php if ( isset ( $checkboxMeta['takh'] ) ) checked( $checkboxMeta['takh'][0], 'تخیلی' ); ?> />تخیلی<br />
<input type="checkbox" name="vah" id="vah" value="yes" <?php if ( isset ( $checkboxMeta['vah'] ) ) checked( $checkboxMeta['vah'][0], 'ترسناک' ); ?> />ترسناک<br />
<input type="checkbox" name="jen" id="jen" value="yes" <?php if ( isset ( $checkboxMeta['jen'] ) ) checked( $checkboxMeta['jen'][0], 'جنایی' ); ?> />جنایی<br />
<input type="checkbox" name="jang" id="jang" value="yes" <?php if ( isset ( $checkboxMeta['jang'] ) ) checked( $checkboxMeta['jang'][0], 'جنگی' ); ?> />جنگی<br />
<input type="checkbox" name="khan" id="khan" value="yes" <?php if ( isset ( $checkboxMeta['khan'] ) ) checked( $checkboxMeta['khan'][0], 'خانوادگی' ); ?> />خانوادگی<br />
<input type="checkbox" name="deram" id="deram" value="yes" <?php if ( isset ( $checkboxMeta['deram'] ) ) checked( $checkboxMeta['deram'][0], 'درام' ); ?> />درام<br />
<input type="checkbox" name="eshg" id="eshg" value="yes" <?php if ( isset ( $checkboxMeta['eshg'] ) ) checked( $checkboxMeta['eshg'][0], 'عاشقانه' ); ?> />عاشقانه<br />
<input type="checkbox" name="elm" id="elm" value="yes" <?php if ( isset ( $checkboxMeta['elm'] ) ) checked( $checkboxMeta['elm'][0], 'علمی' ); ?> />علمی<br />
<input type="checkbox" name="fan" id="fan" value="yes" <?php if ( isset ( $checkboxMeta['fan'] ) ) checked( $checkboxMeta['fan'][0], 'فانتزی' ); ?> />فانتزی<br />
<input type="checkbox" name="kome" id="kome" value="yes" <?php if ( isset ( $checkboxMeta['kome'] ) ) checked( $checkboxMeta['kome'][0], 'کمدی' ); ?> />کمدی<br />
<input type="checkbox" name="maja" id="maja" value="yes" <?php if ( isset ( $checkboxMeta['maja'] ) ) checked( $checkboxMeta['maja'][0], 'ماجرایی' ); ?> />ماجرایی<br />
<input type="checkbox" name="music" id="music" value="yes" <?php if ( isset ( $checkboxMeta['music'] ) ) checked( $checkboxMeta['music'][0], 'موزیکال' ); ?> />موزیکال<br />
<input type="checkbox" name="hai" id="hai" value="yes" <?php if ( isset ( $checkboxMeta['hai'] ) ) checked( $checkboxMeta['hai'][0], 'هیجانی' ); ?> />هیجانی<br />
<input type="checkbox" name="varz" id="varz" value="yes" <?php if ( isset ( $checkboxMeta['varz'] ) ) checked( $checkboxMeta['varz'][0], 'ورزشی' ); ?> />ورزشی<br />
<input type="checkbox" name="west" id="west" value="yes" <?php if ( isset ( $checkboxMeta['west'] ) ) checked( $checkboxMeta['west'][0], 'وسترن' ); ?> />وسترن<br />

<?php }
add_action( 'save_post', 'save_people_checkboxes' );
    function save_people_checkboxes( $post_id ) {
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 
            return;
        if ( ( isset ( $_POST['my_awesome_nonce'] ) ) && ( ! wp_verify_nonce( $_POST['my_awesome_nonce'], plugin_basename( __FILE__ ) ) ) )
            return;
        if ( ( isset ( $_POST['post_type'] ) ) && ( 'page' == $_POST['post_type'] )  ) {
            if ( ! current_user_can( 'edit_page', $post_id ) ) {
                return;
            }    
        } else {
            if ( ! current_user_can( 'edit_post', $post_id ) ) {
                return;
            }
        }

        if( isset( $_POST[ 'ejtemai' ] ) ) {
            update_post_meta( $post_id, 'ejtemai', 'اجتماعی' );
        } else {
            update_post_meta( $post_id, 'ejtemai', '' );
        }
        if( isset( $_POST[ 'asrar' ] ) ) {
            update_post_meta( $post_id, 'asrar', 'اسرارامیز' );
        } else {
            update_post_meta( $post_id, 'asrar', '' );
        }

        if( isset( $_POST[ 'action' ] ) ) {
            update_post_meta( $post_id, 'action', 'اکشن' );
        } else {
            update_post_meta( $post_id, 'action', '' );
        } 
        if( isset( $_POST[ 'anime' ] ) ) {
            update_post_meta( $post_id, 'anime', 'انیمیشن' );
        } else {
            update_post_meta( $post_id, 'anime', '' );
        }

        if( isset( $_POST[ 'bio' ] ) ) {
            update_post_meta( $post_id, 'bio', 'بیوگرافی' );
        } else {
            update_post_meta( $post_id, 'bio', '' );
        }

        if( isset( $_POST[ 'tari' ] ) ) {
            update_post_meta( $post_id, 'tari', 'تاریخی' );
        } else {
            update_post_meta( $post_id, 'tari', '' );
        }

        if( isset( $_POST[ 'takh' ] ) ) {
            update_post_meta( $post_id, 'takh', 'تخیلی' );
        } else {
            update_post_meta( $post_id, 'takh', '' );
        }

        if( isset( $_POST[ 'vah' ] ) ) {
            update_post_meta( $post_id, 'vah', 'ترسناک' );
        } else {
            update_post_meta( $post_id, 'vah', '' );
        }

        if( isset( $_POST[ 'jen' ] ) ) {
            update_post_meta( $post_id, 'jen', 'جنایی' );
        } else {
            update_post_meta( $post_id, 'jen', '' );
        }

        if( isset( $_POST[ 'jang' ] ) ) {
            update_post_meta( $post_id, 'jang', 'جنگی' );
        } else {
            update_post_meta( $post_id, 'jang', '' );
        }

        if( isset( $_POST[ 'khan' ] ) ) {
            update_post_meta( $post_id, 'khan', 'خانوادگی' );
        } else {
            update_post_meta( $post_id, 'khan', '' );
        }

        if( isset( $_POST[ 'deram' ] ) ) {
            update_post_meta( $post_id, 'deram', 'درام' );
        } else {
            update_post_meta( $post_id, 'deram', '' );
        }

        if( isset( $_POST[ 'eshg' ] ) ) {
            update_post_meta( $post_id, 'eshg', 'عاشقانه' );
        } else {
            update_post_meta( $post_id, 'eshg', '' );
        }

        if( isset( $_POST[ 'elm' ] ) ) {
            update_post_meta( $post_id, 'elm', 'علمی' );
        } else {
            update_post_meta( $post_id, 'elm', '' );
        }

        if( isset( $_POST[ 'fan' ] ) ) {
            update_post_meta( $post_id, 'fan', 'فانتزی' );
        } else {
            update_post_meta( $post_id, 'fan', '' );
        }

        if( isset( $_POST[ 'kome' ] ) ) {
            update_post_meta( $post_id, 'kome', 'کمدی' );
        } else {
            update_post_meta( $post_id, 'kome', '' );
        }

        if( isset( $_POST[ 'maja' ] ) ) {
            update_post_meta( $post_id, 'maja', 'ماجرایی' );
        } else {
            update_post_meta( $post_id, 'maja', '' );
        }

        if( isset( $_POST[ 'music' ] ) ) {
            update_post_meta( $post_id, 'music', 'موزیکال' );
        } else {
            update_post_meta( $post_id, 'music', '' );
        }

        if( isset( $_POST[ 'hai' ] ) ) {
            update_post_meta( $post_id, 'hai', 'هیجانی' );
        } else {
            update_post_meta( $post_id, 'hai', '' );
        }

        if( isset( $_POST[ 'varz' ] ) ) {
            update_post_meta( $post_id, 'varz', 'ورزشی' );
        } else {
            update_post_meta( $post_id, 'varz', '' );
        }

        if( isset( $_POST[ 'west' ] ) ) {
            update_post_meta( $post_id, 'west', 'وسترن' );
        } else {
            update_post_meta( $post_id, 'west', '' );
        }
 
}
?>

 

ویرایش شده توسط PRGAME
لینک به ارسال
  • Parsa این مورد را قفل کرد موضوع
مهمان
این موضوع برای عدم ارسال قفل گردیده است.
×
×
  • اضافه کردن...