Community Forums › Forums › Archived Forums › General Discussion › Adding some PHP code to Genesis theme functions.php causes 403 Forbidden error
Tagged: functions
- This topic has 2 replies, 2 voices, and was last updated 9 years ago by
aristo.
-
AuthorPosts
-
May 14, 2014 at 10:00 am #105119
aristo
MemberI have an issue which official support cannot currently answer. I am wondering if anyone else has come across something similar?
I have been using the WordPress editor to update functions.php on the Genesis Sample child theme but when I try to save the updates by clicking on the Update File button I get error 403 Forbidden - Access to this resource on the server is denied!
I have successfully added the same code on a different WordPress installation. This installation is using a free theme. I have tested two code snippets and both cause error on the Genesis Sample child theme installation , however they both work on my other WordPress installation, which makes me think that there is an issue with Genesis Sample child theme.
It can't be file permissions as I have made many updates previously to functions.php.
All my testing points to Genesis. I have 5 themes on my WordPress installation. They are:
Genesis Sample
Genesis
Twenty Fourteen
Twenty Thirteen
Twenty TwelveI tested adding the same code that was causing the 403 Forbidden error to all of theme's functions.php The only ones that failed were the two Genesis themes Genesis Sample and Genesis. Therefore I assume the issue lies with Genesis.
I have double checked the file permissions. Everything is the same across all 5 themes (see evidence of this at File Permission Screen Grabs).
I have uploaded a video that shows the issue in action:
Screen Capture VideoI can successfully add the following (therefore nothing is wrong with the file permissions):
function my_custom_rewrites() { add_rewrite_rule( 'index.php?image=$matches[1]&comms=$matches[2]&commz=$matches[3]', 'top' ); }
But I cannot add
function my_custom_rewrites() { add_rewrite_rule( '^/?database/([0-9]+)/?([a-zA-Z0-9_-]*)/?([a-zA-Z0-9_-]*).html', 'index.php?image=$matches[1]&comms=$matches[2]&commz=$matches[3]', 'top' ); }
For some reason the editor doesn't like this line:
'^/?database/([0-9]+)/?([a-zA-Z0-9_-]*)/?([a-zA-Z0-9_-]*).html',
The line works on other installations. I also have tested it on a normal PHP test page and it is definitely legitimate PHP code.
Any help will be much appreciated thank you.
May 14, 2014 at 11:42 am #105131nutsandbolts
MemberHave you tried editing functions.php via FTP? I was just able to add that function to a test site via FTP and it worked just fine. In general, I wouldn't recommend using the WP editor for functions.php - I only use it for quick stylesheet edits.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 14, 2014 at 11:59 am #105133aristo
MemberI can edit functions.php via FTP and the website works as expected. This is how I have been making my updates to functions.php, but I wanted to know why I was getting the error I was getting. I am new to WordPress and it is annoying me that simple things are not working and I cannot understand why. OK I will avoid using the WordPress editor to update PHP code. Thank you.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.