David on "[Plugin: Gravity Forms + Custom Post Types] HTML Entities Not Escaped in Titles"

ساخت وبلاگ

Hi,

The plugin works flawlessly except when a user adds a title that contains say &. This gets saved in the database as &.

I added the following function to the theme's functions.php file, but when checked in the gravity forms logs, the post data before saving has got &. It still saves as & in the database.


add_filter( 'gform_post_data', 'sanitizetitles', 10, 3 );
function sanitizetitles( $post_data, $form, $entry ) {
//only change post type on form id 3
if ( $form['id'] != 3 ) {
return $post_data;
}
GFCommon::log_debug( __METHOD__ . '(): original post_data => ' . print_r( $post_data, true ) );
$post_data['post_title'] = htmlspecialchars_decode( $post_data['post_title'] );
GFCommon::log_debug( __METHOD__ . '(): modified post_data => ' . print_r( $post_data, true ) );
return $post_data;
}

Gravity support say that they cannot provide any help on this as the form sends the correct data as shown in the gf logs.

Anyone else facing this problem?

V

https://wordpress.org/plugins/gravity-forms-custom-post-types/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 418 تاريخ : چهارشنبه 20 مرداد 1395 ساعت: 0:16