Scenario:
WordPress located and installed on localhost, apache server 2.4.
Using any default WP template i experience this:
let say i need to test wordpress, accessing it via another device connected on network, that need so to point to an IP like this:
http://192.168.1.8/wordpress/
and not
http://localhost/root_integrations/wordpress/
WordPress will loop (i experience this on a Windows OS 8 test but may will be the same on others OS also, i will test as i can)
and i can't access it, let say via smartphone.
Reason:
WordPress fail on locate the right template
stylesheet_uri() on file:
/wordpress/wp-content/themes/twentysixteen/functions.php
where lines:
Code: Select all
wp_enqueue_style( 'twentysixteen-style', get_stylesheet_uri() );
and:
Code: Select all
wp_enqueue_script( 'twentysixteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20160816', true );
you can see that if you change get_stylesheet_uri() with a custom test like this:
Code: Select all
wp_enqueue_style( 'twentysixteen-style', 'http://192.168.1.8/root_integrations/wordpress/wp-content/themes/twentysixteen/style.css' );
then all will work fine (apply the same also to second enqueue mentioned, or just comment out the second, and apply only to the first to test out that will work fine).
Resuming in two word the problem is:
WordPress fail to locate the correct template uri, if WP installed on localhost with
localhost address, and is accessed not via localhost, but via IP address.
So maybe a patch for this could be applied on
wp-includes/theme.php
function get_template_directory_uri()
if it is not an issue about how the server is configured ... or by the way should be patched to return the correct result in any case?