while writing new code and testing it, I incorporate it into my site by testing for the remote IP address as follows; i.e., I'm the only one who will see the new code:
in /functions.php
:
// to hide certain sections/features from people other than myself
$myIP = '219.88.88.88'; // the value as currently indicated by Airport Utility
if( FALSE ) // set to TRUE to initiate Remote Addr test
define( 'ITS_ME', $myIP == $_SERVER['REMOTE_ADDR'] );
else
define( 'ITS_ME', FALSE );
in a template; eg, front-page.php
:
if( ITS_ME ) // IN DEVELOPMENT
echo gregory_get_featured_announcements();
in addition, five domains point to my server because I'm known by 5 different names in various languages. I use $_SERVER['HTTP_HOST']
in a filter function hooked to home_url()
and site_url()
that sets the domain of internal links to the host that the visitor specified.
I'd like to know; is it likely that these will put a heavy load on the server? would a cache plugin like W3 Total Cache
help?
Additional information
my apologies. the question is difficult to understand. s_ha_dum is right. I'm testing on the live server. What I'm doing would never be done in a professional setting. I'm developing my own personal blog.
ITS_ME
is a switch which evaluates to TRUE if the visitor loading the site has my IP address; i.e., the visitor is me. If the switch is on, the code within if( ITS_ME )
conditionals gets executed. This code could be in any of my WP templates. The switch is also used within functions.php
to selectively require()
in-development WP files.
wrt the domains, if a visitor visits me at domain1.com, all of the internal links will be based on domain1.com. if they visit domain2.com, all of the internal links will be based on domain2.com but otherwise, they're seeing exactly the same content. please see https://wordpress.stackexchange.com/a/73621/15311
Gregory
front-page.php
template, I'd check the ITS_ME switch andvardump()
the variable if I was the visitor.