oriver
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: PHP Seed warning but only on live siteThank you for your help. I’m trying to launch a not-for-profit to help people show what they can do for employment and to share their knowledge and passions. Primarily I’m trying to help those who will rely on a very accessible user interface.
The random code you very kindly provided, works beautifully in randomising, though I should have mentioned it needs to work with infinite scroll pagination and the code sadly produces duplicates. Is there anyway to stop this? Or do you know what I might be able to do to fix the error message shown with the first code? Thank you once again for your help.
Forum: Fixing WordPress
In reply to: PHP Seed warning but only on live siteHi @sterndata
Thank you for the link, I tried the code but it unfortunately caused a critical error, was able to delete the code and found the cause was sbt_exclude_category. I tried adjusting to compensate, but no luck.
I agree the original code I’m using isn’t great, and I wish I could use something else, but for now though it could work like a band-aid. I just don’t know why when it works on the staging site with no errors, that for some reason I have this warning:
key “seed” in /home/…public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(484) : eval()’d code on line 10
on the live site.
Forum: Fixing WordPress
In reply to: PHP Seed warning but only on live siteHi @sterndata
Do you mean to make it like:
`session_start([
‘cookie_lifetime’ => 86400,
‘read_and_close’ => true,
]);add_filter(‘posts_orderby’, ‘edit_posts_orderby’);
function edit_posts_orderby($orderby_statement) {
$seed = print_r($_SESSION);
if (empty($seed)) {
$seed = rand();
print_r($_SESSION);
}$orderby_statement = ‘RAND(‘.$seed.’)’;
return $orderby_statement;
}’I’m not code proficient, I found a code to randomise posts but only when opening a new browser, while I removed the two critical errors caused by an open session_start() at the beginning, by including cookie, read and close.
Hi @alanfuller
I really appreciate you’re help. I’ve come up with a sort of code that works:
session_start([ 'cookie_lifetime' => 86400, 'read_and_close' => true, ]); add_filter('posts_orderby', 'edit_posts_orderby'); function edit_posts_orderby($orderby_statement) { $seed = $_SESSION['seed']; if (empty($seed)) { $seed = rand(); $_SESSION['seed'] = $seed; } $orderby_statement = 'RAND('.$seed.')'; return $orderby_statement; }No duplicates, no errors, but it only randomises the posts when opening a new browser. Do you possibly know what I could do to get it to randomise on refresh and/or new tab?
Also it randomises results, not just categories, which is a shame as I would like to keep the results (search, author, tags) in date or search relevance order. Is there anything I can do to change the code from affecting these?
Hi @alanfuller
Thank you for the code, it didn’t work sadly.
I’m needing to randomise posts with pagination infinite scroll, which is part of the complication as I just keep getting duplicates, and when I have a code that mainly works if I click on a post while the page is loading it then causes duplication.
I also keep coming up with roadblocks due to the ‘session start ()’ but if I remove it or try any of the following;
`session_write_close()’
‘session_start([
‘cookie_lifetime’ => 86400,
‘read_and_close’ => true,
]);’‘session_start( [
‘read_and_close’ => true,
] );
}’Then it doesn’t work, but I can’t leave it either as its causing two critical errors.
Sorry for all the codes. Just really stuck on what else to try.
Forum: Fixing WordPress
In reply to: Clearing Disk UsageThank you, that’s really appreciated. Will run a scan promptly and check the plugins.
Thanks again.
Forum: Fixing WordPress
In reply to: Multiple files of the same image, different sizesThat’s brilliant, thank you for clarifying.
Forum: Fixing WordPress
In reply to: Images blank or blue stripesNo errors showing, and disabling plugins haven’t sadly had an effect.
Forum: Fixing WordPress
In reply to: Images blank or blue stripesIt’s also occasionally tearing when the images load on the backend:
but when you hover over the image it corrects itself.
Forum: Fixing WordPress
In reply to: Images blank or blue stripesHi @adamwood
The site isn’t live yet, it’s still being built behind the scenes ready for launch. If it helps I’ve also noticed load up times have become slow, while typing on posts has a very delayed response before appearing.
Any ideas would be more than welcomed
Forum: Fixing WordPress
In reply to: Multiple Errors, Need HelpThank you, your advice has been really helpful. I’ll try to reduce plugins and have a look at outside help, along with upgrading hosting. Many thanks again.
Forum: Fixing WordPress
In reply to: Multiple Errors, Need HelpHi,
I’m a bit unsure about adding lines to the wp-config.php file, as I’m not a developer, my knowledge is basic to getting better.
1. With BlueHost, on Shared Choice.
2. It’s been suggested that the PHP settings were too extreme and would have been adding to the problem. I therefore changed it to:
max_execution_time 1200 max_input_time 1200 max-inputs-vars 4000 memory_limit 1028M post_max_size 128M session.gc_maxlifetime 1440 upload_max_filesize 128M zlib.output_compression DisabledBut post images are taking a long time to appear. Do you please have any suggestions as to what I should change these to?
Thank you
- This reply was modified 4 years, 1 month ago by oriver.
Forum: Fixing WordPress
In reply to: Multiple Errors, Need HelpI think my host server may have gone a little far in changing the PHP settings to solve the cURL issue, which it didn’t fix.
The settings currently are:
max_execution_time 20000
max_input_time 20000
max-inputs-vars 20000
memory_limit 8192M
post_max_size 8192M
session.gc_maxlifetime 1440
upload_max_filesize 8192M
zlib.output_compression DisabledWould it be best to change these? Thanks again
Forum: Fixing WordPress
In reply to: Multiple Errors, Need Help1) I’m on a shared hosting plan, max database 5GB
2) I found the file but the two lines were missing. I did find a summary of the PHP settings which states: memory_limit 8192, post_max_size 8192, upload_max_filesize 8192.
Forum: Plugins
In reply to: [UpdraftPlus: WP Backup & Migration Plugin] Warning backupServer fixed.