/** * 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' );
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter