Try not to use capital letters in the shortcode attributes, use for example
[wi_form product_name="php" product_price="888" ]
where:
add_shortcode( 'wi_form' , 'wi_form_func' );
function wi_form_func($input) {
extract(shortcode_atts( array(
'product_name' => 'Java',
'product_price' => 1000
), $input));
return $product_name . esc_attr( $product_price );
}
or this:
add_shortcode( 'wi_form' , 'wi_form_func' );
function wi_form_func($input) {
$input = shortcode_atts( array(
'product_name' => 'Java',
'product_price' => 1000
), $input );
return $input['product_name'] . esc_attr( $input['product_price'] );
}
if you don’t want to use extract
:
Update:
The shortcode attributes go through strtolower()
in the shortcode_parse_atts()
function that retrieves them from the shortcode tag (see here).