Hi @cncup,
I recommend using the “Run Everywhere” location for that filter as that makes it run similarly with adding the code to functions.php.
Thread Starter
cncup
(@cncup)
Hi Mircea,
Thank you for the reply.
Yes it works in “Run Everywhere” when I also remove the condition “Type of page is Homepage”. Initially when setting the condition, the plugin changes the location automatically to “Frontend Conditional Logic”. It allows to change it back to “Run Everywhere” while the condition is still on, but apparently treats it underneath as “Frontend Conditional Logic”, hence the filter code doesn’t work as long as the condition is there.
I can do without the condition and check in the code if it’s homepage, no problem. Just to know in general, is there a way to have the condition and also “Run Everywhere”? Not what is shown as saved but underneath truly.
Thanks.
Hi @cncup.
The plugin will save your snippet as Run Everywhere but the conditional logic for that will always fail as at the time when the Run Everywhere code is being executed all the details regarding the current page are not yet fully loaded.
That is why we added the Frontend Conditional Logic location that is executed later, after all the details were loaded. Adding a condition inside the code to check if it’s the homepage will not work for the same reason unless you find a way to write the code that allows that, if possible.
For reference, “Run Everywhere” uses the “plugins_loaded” action and the “Frontend Conditional Logic” location uses the “wp” action.
Thread Starter
cncup
(@cncup)
Thanks Mircea. Lucky you explained or I wouldn’t have known why my homepage check isn’t working. I resorted to using php’s $_SERVER and a check against the site url. It works.
Thanks for the references too. Much appreciated.
