Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I extend the nonce life in the Public Post Preview plugin?

I'd like to extend the length of the URL preview duration in the 'Public Post Preview' Wordpress plugin.

The default for an unpublished post via a generated link is 48 hours. I have seen the suggested code on Stack Overflow to extend the duration (example below is 7 days).

My question is: where do I amend the filter value from 48 hours? Which exact file do I need and where is it located?

I'm not a developer but would be accessing files via FTP and doing it myself so so step-by-step would be really helpful. Thanks in advance for any advice, it's something I've been meaning to do for literally years!

add_filter( 'ppp_nonce_life', 'my_nonce_life' );
function my_nonce_life() {
    return 60 * 60 * 24 * 7; // 7 days
}
like image 478
John_F Avatar asked Nov 20 '25 12:11

John_F


1 Answers

You can put this code into the functions.php file that you will find in the folder that contains your active WordPress theme.

For example if your theme is called "Super Theme", browse to your wp-content/themes folder and find the folder for your active theme, probably called something like super-theme. In there, you'll find many files, including one called functions.php.

Open that file and pop the code into it. You can add it right at the start or at end, but make sure you put it after the opening <?php tag which is normally right at the top of that file.

like image 73
UKcentric Avatar answered Nov 22 '25 03:11

UKcentric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!