Converting Data Fields from integer to text types

#14801
  • Resolved Paul Van Slyke
    Rank Math free

    Dear Rank Math,

    I am a super fan of your plugin, but I have noticed that your plugin is causing at least one of my user specified data fields (To be specific, the ‘pricing’ data field) in my Real Estate Theme for individual property listings (Contempo Real Estate 7 WordPress) to convert from a numerical or integer format, to what appears to be a text format.

    For example, when your plugin is activated, each time I input or type-in a numerical value for the price field as ‘13950000’ it gets converted to what appears to be a text data type of the form ‘13,950,000.00’ (with commas and the decimal place) after pressing the update button. If I deactivate or turn off your plugin, the price data field remains as it should in the correct numerical format (ie 13950000) whenever updated.

    This forced conversion by the Rank Math SEO plugin is causing the search function on my website to fail locating any properties that have had their prices converted into this new data type. For example, any new real estate listings created while the Rank Math plugin is currently activated will not show up in search results where a user searches for properties within a specific price range.

    Is there a setting that I need to change to ensure that the Rank Math SEO plugin doesn’t force this conversion from happening?

    Any help you can provide is greatly appreciated. Thank you!

    Kind Regards,

    Paul

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I have raised this issue with our dev team and we will be getting back to you in a short while to help further.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for providing access. I was able to reproduce this issue on my setup with the WP Pro Real Estate 7 theme & Contempo Real Estate Custom Posts plugin.

    The CMB2 package used in Contempo Real Estate Custom Posts plugin is conflicting with the CMB2 package which we are using in the Rank Math plugin. By default CMB2 package adds comma and decimal in the text_money field.

    The plugin author has changed the code in the cmb2 package itself to prevent the price field from saving value with comma and decimal point which is not good. You will see the code which they edited in the package in plugins/contempo-real-estate-custom-posts/cmb2/includes on line 257 – 265. Instead of changing the core code, they should use CMB2’s sanitization_cb field. You can read more about it here: https://github.com/CMB2/CMB2/wiki/Field-Parameters#sanitization_cb

    Please contact the plugin author and ask them to make the below changes. For the price field, they should add a sanitization_cb function. In plugins/contempo-real-estate-custom-posts/ct-real-estate-cmb2-functions.php tell them to
    replace the code on line 202

    
    $ct_post_cmb->add_field( array(
    		    'name' => __('Price', 'contempo'),
    			'desc' => __('Enter the price here, without commas or seperators. If empty no price will be shown.', 'contempo'),
    			'id' => $prefix . 'price',
    			'tab'  => 'information',
    	        'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
    			'type' => 'text_money'
    		) );
    
    

    with

    
    $ct_post_cmb->add_field( array(
    		    'name' => __('Price', 'contempo'),
    			'desc' => __('Enter the price here, without commas or seperators. If empty no price will be shown.', 'contempo'),
    			'id' => $prefix . 'price',
    			'tab'  => 'information',
    	        'render_row_cb' => array('CMB2_Tabs', 'tabs_render_row_cb'),
    			'type' => 'text_money',
    			'sanitization_cb' => 'ct_sanitize_money_field',
    		) );
    

    They will have to create a new function ct_sanitize_money_field with the below code.

    
    function ct_sanitize_money_field( $value ) {
    	return $value;
    }
    

    This should fix the issue. I checked it on my setup, you can also try it on your site and then forward it to the plugin developer.

    Hope that helps. Thank you.

    Hi Pratik,

    Thank you so much for the update and information regarding the conflict in the plugin. I will certainly let the original plugin developer know about this. Again, thank you very much!!

    Kind Regards,

    Paul

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

The ticket ‘Converting Data Fields from integer to text types’ is closed to new replies.