WC_Post_Data::decode_coupon_code_for_editing
Decode coupon codes for the title field on the coupon edit screen.
WordPress encodes titles again for editing, so the field would otherwise show & instead of &.
Method of the class: WC_Post_Data{}
No Hooks.
Returns
string.
Usage
$result = WC_Post_Data::decode_coupon_code_for_editing( $title, $post_id );
- $title(string) (required)
- Post title.
- $post_id(int) (required)
- Post ID.
Changelog
| Since 11.3.0 | Introduced. |
WC_Post_Data::decode_coupon_code_for_editing() WC Post Data::decode coupon code for editing code WC 11.3.0
public static function decode_coupon_code_for_editing( $title, $post_id ) {
if ( ! is_string( $title ) || 'shop_coupon' !== get_post_type( $post_id ) ) {
return $title;
}
return html_entity_decode( $title, ENT_QUOTES | ENT_HTML5, get_bloginfo( 'charset' ) );
}