• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Adding some PHP code to Genesis theme functions.php causes 403 Forbidden error

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Adding some PHP code to Genesis theme functions.php causes 403 Forbidden error

This topic is: resolved

Tagged: functions

  • This topic has 2 replies, 2 voices, and was last updated 11 years ago by aristo.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 14, 2014 at 10:00 am #105119
    aristo
    Member

    I 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 Twelve

    I 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 Video

    I 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 #105131
    nutsandbolts
    Member

    Have 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 #105133
    aristo
    Member

    I 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.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble