I want to prevent access to the functions file in my WordPress theme. I thought to hide functions.php by putting it on my server and calling it from the client’s server. Is that a workable solution? Is there a better approach?
Leave a Reply
You must be logged in to post a comment.
Why not change permissions? You could also move it to a non-public part of the directory tree and place a fwd file and code. That is how I use wp-config. I don’t see why you couldn’t do that with functions.php
This is technically possible if your client’s server has allow_url_include set. However, it’s still a bad idea for four reasons:
include
. Additionally, if your server is ever compromised or someone snatches your domain, they can then inject code onto your client’s server with impunity.Re-homing executable code on your server is probably a really bad idea, and while it is absolutely technically possible, there are many compelling reasons why doing things this way are a bad idea.
If you are trying to protect proprietary code from the client, your only good options are to:
You can just put a .htaccess rule that redirects /functions.PHP to your homepage. This is what Facebook does.
Edit: see my comment below.