Change decimal places

Hello,
I have already searched the forum but the solutions I found do not work.
I have as indicated :

function affiliates_change_decimals_example( $decimals, $context ) {
if ( $context === ‘display’ ) {
$decimals = 2;
} else {
$decimals = 6;
}
return $decimals;
}
add_filter(
‘affiliates_referral_amount_decimals’,
‘affiliates_change_decimals_example’
);
entered in the wp config function.php but it comes critical WordPress error.
What can i do?

3 Responses to Change decimal places

  1. George May 19, 2022 at 1:39 pm #

    Hey Kevin,

    The error looks as if the code you added has encoded characters instead of literal characters like ie the single quote. My guess is that you copy/pasted the encoded HTML output but it doesn’t matter.

    I would recommend you to remove the snippet from functions.php and also any other code you have added related to the amount of decimals on your wp-config.php file.
    Instead of these you may use the following plugin I’ve prepared for that purpose.
    Please go to this link,

    download the zip file
    then uncompress and rename the folder to affiliates-referrals-amount-decimals
    compress the renamed folder with zip again
    upload and install it as a plugin on your site
    activate it

    and you’re good to go. If you wish to modify the amount of decimals then you should only modify the plugin file.

    Kind regards,
    George

  2. Kevin Spanier May 18, 2022 at 4:25 pm #

    hello,
    i have allowed debugging in config but no debug.log was created i could only find this warning in the log(plesk) now
    “mod_fcgid: stderr: PHP Warning: Use of undefined constant \xe2\x80\x98affiliates_change_decimals_example\xe2\x80\x99 – assumed ‘\xe2\x80\x98affiliates_change_decimals_example\xe2\x80\x99’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/”website”/httpdocs/wp-content/themes/”using Theme”/functions.php on line 551, referer: https://newsrux.com/wp-cron.php?doing_wp_cron=1652890543.8183119297027587890625
    and
    “mod_fcgid: stderr: PHP Warning: Use of undefined constant \xe2\x80\x98affiliates_referral_amount_decimals\xe2\x80\x99 – assumed ‘\xe2\x80\x98affiliates_referral_amount_decimals\xe2\x80\x99’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/”website”/httpdocs/wp-content/themes/”using Theme”/functions.php on line 550

    thanks and bests

  3. George May 18, 2022 at 11:38 am #

    Hi Kevin,

    Sorry to hear that you have issues with the filter hook snippet. Please make sure to put the snippet in functions.php file of your active theme, preferably a child theme so that you won’t lose it upon a future update of your theme.
    As for the error, you will get additional indicators if once you enable WP debugging, you try to visit your site. The error details will be included in wp-content/debug.log.

    For further assistance you may follow-up on this thread.

    Kind regards,
    George

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share