I know how to do wordpress conditional statements based on a page ID, page name or url slug, but I’m looking to do something slightly different. I’m looking for a conditional statement for my 404 page that will help me display different content if the URL begins with mysite.com/wiki/.
Is there some kind of wildcard I could use, like * or % or something like that?
Welcome to StackOverflow.
I believe this is what you are looking for on your 404 page:
strpos() will return false if the search text was not found, or the 0-based index that the match occurred at in the string.
We are checking to see if ‘/wiki’ was at the beginning of $uri, and if so it outputs one message, if not, it outputs another.