Check the number of input variables submitted.
Tue Feb 28 2023 04:22:24 GMT+0000 (Coordinated Universal Time)
Saved by
@hasan1d2d
/**
* The check_post_input_vars
*
* @return void
*/
function check_post_input_vars() {
// $array = array(
// 'sp_pcp_view_options' => array(
// 'pcp_select_post_type' => 'post',
// 'pcp_select_filter_product_type' => 'none',
// 'pcp_sticky_post' => 'normal_position',
// 'pcp_post_limit' => '20',
// 'pcp_post_offset' => '',
// 'pcp_advanced_filter' => array( 'sortby' ),
// ),
// );
// Get the exact number of input variables in $_POST
$input_count = count( $_POST, COUNT_RECURSIVE ) - count( $_POST );
echo( '<pre>' );
var_dump( $input_count );
echo( '</pre>' );
echo( '<pre>' );
var_dump( $_POST );
echo( '</pre>' );
// Do something with the number of input variables
// echo "Number of input variables submitted: " . $num_input_vars;
die;
}
add_action( 'save_post', 'check_post_input_vars' );
content_copyCOPY
Comments