Hi there,
Could you please let me know what action happens right before this warning is triggered? In most cases, the request method should be available unless the site is being accessed outside of the browser.
Kind regards,
I cannot answer your question because it is a warning that I am merely noticing in my error_log file. I wouldn’t notice it browsing my site anyway as I don’t have PHP errors set for that. But it should be a simple fix on your end (check that exists first I would think).
Hi there,
Unfortunately, I haven’t been able to replicate this. Are you using a server-side cron instead of the WordPress cron? However, I’ll get with our development team about adding a check to ensure that $_SERVER[‘REQUEST_METHOD’] is set before using it.
Kind regards,
Yes, actually, I am using a server-side cron.
Hi there,
Thank you for checking that. In the meantime, could you try adding this line to your site’s wp-config.php file and see if that prevents those notices from getting logged?
$_SERVER['REQUEST_METHOD'] = array_key_exists( 'REQUEST_METHOD', $_SERVER ) ? $_SERVER['REQUEST_METHOD'] : 'GET';
Kind regards,
I added it but still getting the error notices.
Hi there,
Thank you for trying that. If you have access to your site’s filesystem through something like cPanel or FTP, could you please open the PrliAppController.php file under wp-content/plugins/pretty-link/controllers/ and then on line 33 replace this line:
if($_SERVER["REQUEST_METHOD"] == 'GET' && !is_admin()) {
With this:
if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER["REQUEST_METHOD"] == 'GET' && !is_admin()) {
And see if that removes the notice?
Kind regards,
Yes, that seems to have fixed things.
Hi there,
I just wanted to follow up on this thread and let you know that we’ve released a new version of Pretty Links that includes a fix for this warning, so if you haven’t already please upgrade to this version (3.3.0) and the warning will no longer be logged going forward.
Kind regards,