I’ve created this code branch so that if the permalink settings do no match at least one of the OR conditions, I can execute the “do something” branch. However, I believe there is a flaw in the logic, since I’ve set permalinks to /%postname%.html and it still tries echo’s true;
I believe I need to change the ORs to AND, right?
if (get_option('permalink_structure') !== "/%postname%/" ||
get_option('my_permalinks') !== "/%postname%/" ||
get_option('permalink_structure') !== "/%postname%.html" ||
get_option('my_permalinks') !== "/%postname%.html"))
{
//do something
echo "true";
}
You are testing :
And your permalink is
/%postname%.html— which means it is not"/%postname%/"So, that first portion of the condition is
true, and you are entering into theifblock — and the other ones are not even evaluated.I suppose what you want is to use
&&, and not||:Which would mean :
"/%postname%/""/%postname%/""/%postname%.html""/%postname%.html"