Site logo

[Support request] Edit functions.php from wordpress editor error

Home Forums Support [Support request] Edit functions.php from wordpress editor error

Home Forums Support Edit functions.php from wordpress editor error

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #728773
    Ramón

    I have a clean wordpress installation with the GeneratePress theme. The problem is that, from the wordpress edition page, Apperance ->Edit, it does not allow me to modify the functions.php file. When I try to save the file modifications I get the following error:

    Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP

    .
    Thank you

    #728834
    Leo
    Staff
    Customer Support

    Hi there,

    It’s not a good idea to edit the theme’s core files as it won’t be saved through updates.

    Try using a child theme instead:
    https://docs.generatepress.com/article/adding-php/#use-a-child-theme
    https://docs.generatepress.com/article/using-child-theme/

    #728878
    Ramón

    Thanks Leo, but same problem with child theme.
    Notice that I have a clean installation of wordpres without plugins and only the themes twenty-seven, genesis, generatepress and generatepress child.

    #729165
    David
    Staff
    Customer Support

    Hi there,

    this article gives good overview of the potential issues and how to test:

    https://wpengine.co.uk/support/php-editor-errors-wordpress-4-9-higher/

    #1311007
    Alex

    Hi! I have the same issue, although it only happens with the child theme.

    I disabled all plugins, only switching from the child theme to the main theme did the functions.php editor work. I can only edit the child theme’s functions.php when the theme is deactivated.

    How could I fix it?

    #1311178
    David
    Staff
    Customer Support

    Hi there,

    do you have any functions in your child theme ?

    #1313733
    Alex

    Hi David,

    Sorry for the late response.

    I’ve added multiple functions to my child theme. The Theme Editor for functions.php stopped working out of the blue (after I added quite a bit of code), and I’ve used FTP to edit the file since I started getting the “Unable to communicate back with site…” error.

    I also added a new file within the child theme folder for loading custom SVG icons, and I’m accessing it via require_once PHP function from functions.php. I’m suspecting that might have something to do with the error(?)

    P.S. Thanks for the support, you’re doing a great job

    #1313902
    David
    Staff
    Customer Support

    It definitely sounds like one of your functions is causing the issue. And the use of require_once could be at fault. The simplest way to tell is to remove each function to see which is at fault.

    #1315182
    Alex

    Would it be advisable to add the code via plugin, instead of adding them to functions.php?

    I’m mostly creating shortcodes for SVG buttons and custom SVG icons.

    #1315409
    David
    Staff
    Customer Support

    I personally try to avoid using the Theme Editor – i would work with the Code Snippets plugin to create the shortcodes. Then when i am happy i would cut and paste them into my functions.php via FTP.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.