Quantcast
Channel: When to use is_home() vs is_front_page()? - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 5

Answer by Dylan Pierce for When to use is_home() vs is_front_page()?

$
0
0

I've discovered that is_home() and is_front_page() don't deliver what's expected for multisites. My workaround using built in PHP goodies:

if($_SERVER['REQUEST_URI'] == '/') {    // you must be on the home page}

As mentioned in the comments, this approach will not work for WP instances installed in subdirectories of the web root. Use at your discretion.


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>