Local Host \ Online Hack
-
Evidently the coders of WordPress, never assumed that I would like to host WordPress from a machine and use it on that very same machine. Now, I know there a serious reprecussions of dealing with the matter this way, but I decided that it would work well enough for my purposes.
Place this code inside of your
get_settings()
function in thefunction.php
file of WordPress.// Allow Local & Online Viewing
if ( 'siteurl' == $setting || 'home' == $setting ) {
$ip = $_SERVER['REMOTE_ADDR'];
if ('127.0.0.1' == $ip) {
$value = 'https://localhost';
} else {
$value = 'online url';
}
}
The best idea for your viewers would be to make your default siteurl in your options to the online URI, so that way they can get all the benefits, while you get basic access, just enough to play around though. I’ll eventually make a more extensive hack to give the same online abilities to local, and hell, if I can figure out how I can manage it, I might make it a a plugin.
- The topic ‘Local Host \ Online Hack’ is closed to new replies.