How to stop editing functions.php in WordPress

Theme updates put the file back. Put the same PHP in a Functions snippet instead, with an off switch.

Don’t open Appearance → Theme File Editor. Don’t FTP into functions.php. Don’t keep a sticky note of which child theme file you patched last week. The next theme update puts the original file back, and your PHP is gone.

I keep that code in FluentSnippets. One Functions snippet. Same hooks. An off switch when I want it quiet.

When this is the wrong post

If you are building a theme you will ship to other people, the code belongs in the theme. Don’t peel it into a snippet on your laptop and forget it.

If the PHP has to run before plugins load, a snippet is too late. That belongs in wp-config.php or a must-use plugin.

If Google (or Meta) only sent you a tag to paste, you want the header and footer walk. That’s HTML, not PHP.

Install FluentSnippets

Get it from WordPress.org or from our get page.

In wp-admin go to Plugins → Add New. Search FluentSnippets. Click Install, then Activate.

No account. Open FluentSnippets in the left menu. You’re on the snippets list.

Leave Functions selected

This is PHP, the same kind of code that used to live in functions.php. Functions (PHP) is already selected when you arrive. Leave it.

Open FluentSnippets.

The FluentSnippets snippets list, with a dark New Snippet button in the upper right.
The snippets list. Look at the dark navy New Snippet button in the upper right. Click that.

Click New Snippet.

Create New Snippet. Functions (PHP) is selected. The editor already shows a gray php tag. Where to Run is set to Run Everywhere.
Create New. Look at the four types across the top. Functions (PHP) is already selected. Leave it. The editor already has a gray <?php on the first line. Don't type a second one. Where to Run? is already Run Everywhere. Leave that too.

Name it something you’ll recognize later. For this walk I’ll use Remove WordPress version.

The paste is PHP, not a tag

This is a tiny, common functions.php paste. It stops WordPress from printing its version in the page head.

Paste under that gray first line. Don’t wrap it. Don’t add another <?php.

remove_action( 'wp_head', 'wp_generator' );

Click Create Snippet. Then publish it. You want the green published badge.

View source on a public page. Search for generator. That meta tag should be gone.

The list after it is on

Go back to the snippets list.

The FluentSnippets snippets list with published Functions rows in groups like Cleanup.
Same list. Look for the row you named. In this shot other Functions rows already sit in groups like Cleanup. Yours will look the same once it is published. Turn the row off anytime you want the old behaviour back.

Anything else you used to drop into functions.php follows the same clicks. Change the paste. Keep the type on Functions (PHP). Keep Run Everywhere unless you only want admin or only the front.

A few other common pastes live in the Functions docs: a current-year shortcode, a shorter excerpt, a body class on one page.

One rule to keep

If you would have opened functions.php, open FluentSnippets instead. Theme updates cannot eat a published snippet, and you don’t have to remember which file you touched.

How to disable WordPress comments without a comments plugin if you want a longer Functions paste. Functions snippets for run locations and why a second <?php is refused.

Enjoyed this? Get the next one by email.

New articles, practical snippets and feature walkthroughs — sent when there's something worth reading, not on a schedule.

No spam, no selling. Unsubscribe anytime.

Custom code, without the database.

FluentSnippets is free on WordPress.org. Zero queries, no lock-in.