Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

wordpresss plugins url function not working on shared hosting

wordpresss plugins url function not working on shared hosting  using -'php,wordpress'

A site I've built uses the Advanced Custom Fields plugin, and everything works well on localhost on my own web host.  Unfortunately, when I moved the site to the hosting that the client purchased (GoDaddy shared hosting), the JavaScript and CSS files for the Advanced Custom Fields plugin are not loading properly.  Checking the source, the problem is clear - they are pointing to the following path:

(if you look carefully you can see that there's a reference to the actual path of the file on the server, not the URL)

I've traced the problem to the following line in the plugin:

$this->dir = plugins_url('',__FILE__);

It should be returning /wp-content/plugins/advanced-custom-fields

Instead it's returning /wp-content/plugins/home/content/06/10145906/html/wp-content/plugins/advanced-custom-fields

I've edited the plugin file so that it points to the proper path, but those changes will revert back every time the plugin is updated, so it's not a long term solution.

I've seen some people complain that the __FILE__ magic constant doesn't work as expected with symlinks, but I certainly didn't create any symlinks.  Is this a limitation of using GoDaddy?


I've noticed that __FILE__ returns something different on GoDaddy than on my local machine or on my other web server.  One the two working machines it return the full path, from the root of the file system (ie, /srv/www/sitename/public_html/file.php), while on GoDaddy the path it returns begins at the home directory (/home/content/06/10145906/html/file.php).

Could that be the problem?

asked Oct 7, 2015 by deepak
0 votes

Related Hot Questions

Government Jobs Opening