How to edit a WordPress site with Cursor safely

Use Cursor to change and fix an existing WordPress site safely: back up first, use a child theme, let the AI read debug.log, and review every change.

4–6 minutes

Cursor is very good at the jobs that make WordPress owners nervous: finding why a site shows a critical error, changing a template, or adding a small feature without a plugin. The risk is that it edits a live site instantly. This guide shows a workflow where every change is backed up, reviewed and reversible.

Back up the database and files first, open the site in Cursor (a local copy, or the live server over Remote-SSH), and put your changes in a child theme under Git. Use Ask mode to diagnose, mentioning files such as @debug.log, then switch to Agent to make the change. Review the highlighted lines, click Keep, test the site, and commit.

The pictures are illustrations of each step, based on Cursor’s real interface.

Choose where to edit

WhereGood forRisk
A local copy (Studio or Local)Larger changes, redesignsNone to visitors; you upload when finished
A staging site over SSHTesting on the real server setupLow; staging is separate
The live site over SSHUrgent fixes, small tweaksHigh; changes are live on save

For the live or staging options, first connect Cursor to the server over SSH. On shared hostingShared hosting Hosting where your website shares one server with many others. Cheap and simple; the host looks after the server. More about Shared hosting → without SSH, download the site, work on it locally, and upload the changed files.

Step 1: Back up and start version control

Illustration of Cursor connected to a server, with a child theme selected and a terminal exporting the database and creating a Git commit
Illustration: work in the child theme (1), export the database (2), and commit the files before any edit (3).

Open the terminal (Ctrl+`) and take a database backup with WP-CLI:

wp db export ~/backups/before-edit.sql

Then put the theme you will edit under Git, so any change can be undone with one command:

cd wp-content/themes/twentytwentyfive-child
git init
git add .
git commit -m "Before Cursor edits"

Make changes in a child theme (1), never the parent theme or a plugin, because updates overwrite those files. If you do not have one, ask Cursor: “Create a child theme of Twenty Twenty-Five called twentytwentyfive-child.” For a full-site backup as well, see backups in cPanel.

Step 2: Diagnose with Ask mode

Illustration of debug.log showing a PHP fatal error, with Cursor in Ask mode explaining that get_field comes from a deactivated plugin
Illustration: the fatal error line (1), Ask mode (2), and the explanation (3).

To find a problem without changing anything, switch the AI panel to Ask mode (2). Turn on WordPress’s error log by adding these lines to wp-config.php, above the “That’s all, stop editing” line:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reload the broken page, then ask about the log, mentioning files with @:

@debug.log @functions.php The site shows "There has been a critical
error". What is wrong? Do not change anything yet.

Cursor reads the fatal error (1) and explains it in plain terms (3). Here, the theme calls a function from a plugin that has been deactivated. More causes are in the WordPress white screen guide.

Step 3: Make the change and review it

Illustration of functions.php showing a removed line and four added lines guarding the call with function_exists, with Keep and Undo buttons
Illustration: the added lines are highlighted (1); keep or undo the change (2).

Switch to Agent mode and ask for the fix in one sentence:

Make the banner skip itself when ACF is not active.

Read the highlighted lines (1) before accepting. Check that the change is in the file you expected, that it only touches what you asked for, and that any output is escaped with functions like esc_html(). Click Keep to save or Undo to reject (2). On a live site, the saved file is live immediately.

Step 4: Test and commit

Illustration of a terminal running a PHP syntax check, flushing the cache, checking the home page returns 200, and committing to Git
Illustration: syntax check passes (1), the home page returns 200 (2), and the fix is committed (3).

Check the change before you walk away:

php -l wp-content/themes/twentytwentyfive-child/functions.php
wp cache flush
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/

A clean syntax check (1) and a 200 from the home page (2) mean the site is up. Visit the pages you changed in a private browser window, then commit (3):

git commit -am "Guard promo banner when ACF is inactive"

If anything is wrong, git checkout . puts every file back as it was at the last commit, and wp db import ~/backups/before-edit.sql restores the database. Turn WP_DEBUG back off when you are done.

What to ask Cursor, and what not to

Good jobs for CursorDo these yourself, or with great care
Explaining errors in debug.logEditing WordPress core files
Small template and CSS changes in a child themeChanging plugin files, which updates will overwrite
Writing a small custom function or shortcodeBulk database changes; use wp search-replace --dry-run first
Reviewing code for security and escapingAnything involving payment or user data, without review
Writing WP-CLI commands for repetitive tasksChanging wp-config.php secrets

Never paste passwords, API keys or customer data into the chat. Cursor’s settings include a Privacy Mode; turn it on for client work.

Common problems

ProblemCauseFix
Change saved but nothing changes on the sitePage cache or CDNwp cache flush, purge the cache plugin and CDN
Edits disappear after an updateParent theme or plugin file was editedMove the change to the child theme
Agent wants to edit many unrelated filesRequest too vagueAsk for one change, name the file with @
Site broken after KeepThe change had a buggit checkout . to undo, then ask again with the error
“Permission denied” when saving over SSHFiles owned by another userConnect as the site’s user, or fix ownership

Get the next guide

One email when there is something worth reading: new guides, errors going around, and hosting changes that affect your site.

No tracking pixels, and one click to leave.

Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.