Developer · Guide
How to See Code in WordPress (Step by Step)

Short answer
To see the code of a post in WordPress, open the block editor, click the three-dot Options menu and choose Code editor. To see a live page's code, right-click it in your browser and choose View Page Source or Inspect. Theme and plugin files are under Appearance or Tools, or by FTP.
Key takeaways
- The block editor's Code editor shows a whole post's HTML; Edit as HTML shows one block.
- View Page Source shows the final HTML that visitors receive.
- Browser developer tools show live HTML and CSS, and changes there are temporary.
- Theme and plugin files can be viewed in the file editors or by FTP.
- If the file editors are missing, DISALLOW_FILE_EDIT or your host has turned them off.
What does it mean to see code in WordPress?
Seeing code in WordPress can mean three things: viewing the HTML of a post in the editor, viewing the source of a live page in your browser, or viewing the PHP, CSS and JavaScript files of your theme and plugins.
Each one lives in a different place. Post HTML is in the editor. Page source and live CSS are in your browser. Theme and plugin files are on your server, with an optional editor inside the admin area.
Pick the method that matches what you want to do. Checking why a button looks wrong needs browser tools, while fixing a template needs the theme files.
| What you want to see | Where to look | Can you edit it there? |
|---|---|---|
| HTML of a single block | Block menu > Edit as HTML | Yes |
| HTML of a whole post | Editor options > Code editor | Yes |
| Final page HTML | Browser View Page Source | No |
| Live CSS and layout | Browser developer tools | Temporary only |
| Theme files | Theme File Editor or FTP | Yes, with care |
| Plugin files | Plugin File Editor or FTP | Yes, but not advised |
How do you see the HTML of a post in the block editor?
Open the post, click the three-dot Options menu in the top-right corner, and choose Code editor to see the whole post as HTML with block comments.
- Open any post or page in the block editor
- Click the vertical three-dot menu at the top right
- Under Editor, choose Code editor
- Read or edit the HTML
- Click Exit code editor to return to the visual view
The keyboard shortcut is Ctrl+Shift+Alt+M on Windows or Cmd+Shift+Option+M on a Mac. Press it again to switch back.
You will see HTML comments such as <!-- wp:paragraph -->. These are block markers. WordPress uses them to rebuild the blocks, so do not delete them unless you mean to remove a block.
WordPress's guide to the block editor explains the editor's menus and views in more detail.
How do you see the code of one block?
Select the block, click its three-dot menu in the block toolbar, and choose Edit as HTML to view and change that block's markup only.
This is safer than the full code editor because you only touch one block. Click Edit visually in the same menu to switch back.
If WordPress says the block contains unexpected or invalid content after you edit it, the HTML no longer matches what the block expects. Click Attempt recovery or convert it to a Custom HTML block.
To add your own markup instead of viewing it, use the Custom HTML block. Our guide on how to add HTML in WordPress covers when to use each option.
How do you see code in the classic editor?
In the classic editor, click the Text tab at the top right of the editing box to see the post's HTML, and click Visual to return.
The Text tab shows plain HTML without block comments. WordPress adds paragraph tags automatically when it displays the post, so you may not see p tags around every paragraph in this view.
How do you view the source code of a WordPress page?
Open the page in your browser, right-click an empty area and choose View Page Source, or press Ctrl+U on Windows or Cmd+Option+U on a Mac.
The page source is the final HTML that WordPress sends to visitors. It includes your theme's header, plugin scripts, meta tags and the post content.
This view is read-only. It is useful for checking things like:
- Whether a tracking code or verification tag is present
- Which SEO title and meta description are output
- Which stylesheets and scripts load on the page
- Whether a caching plugin has added its signature comment
Use Ctrl+F in the source window to search for the text you need. You can view the source of any website this way, not only your own.
How do you inspect code with browser developer tools?
Right-click any element on the page and choose Inspect to open the developer tools, which show the live HTML and the CSS rules applied to that element.
Every modern browser has developer tools. Press F12, or Ctrl+Shift+I on Windows and Cmd+Option+I on a Mac. Chrome documents the ways to open DevTools in its help pages.
The Elements panel shows the HTML tree. The Styles pane shows which CSS rules apply and which file they come from. You can tick rules on and off to test a change.
Changes in developer tools are temporary. They vanish when you reload, which makes this a safe place to experiment before you copy a working rule into your site.
MDN has a plain-English overview of browser developer tools if you have not used them before.
The Console tab is also worth a look when something breaks. JavaScript errors from plugins show up there in red.
How do you see your theme's code in WordPress?
Go to Appearance > Theme File Editor in a classic theme, or Tools > Theme File Editor in a block theme, then pick a file from the list on the right.
WordPress shows a warning the first time you open the editor. Read it. A typing mistake in a PHP file can take your site down, and the editor has no undo once you save.
The Theme File Editor screen lists files such as style.css, functions.php and template files. Block themes also contain HTML templates and a theme.json file.
If you plan to change theme files, use a child theme. Updates to the parent theme overwrite edits made directly to it. Our explainer on what a child theme is shows why.
In block themes you can also view template code in the Site Editor. Open a template, then switch to the code editor from the Options menu to see its block markup.
How do you see plugin code in WordPress?
Go to Plugins > Plugin File Editor, choose the plugin from the drop-down menu, and select a file to view its code.
Viewing is fine, but avoid editing plugin files. The next plugin update replaces them, and your changes disappear without warning.
To change how a plugin behaves, add a code snippet that uses the plugin's hooks instead. Our guide on how to add code to WordPress covers safe ways to do that.
Why can't you see the Theme File Editor?
The file editors are hidden when DISALLOW_FILE_EDIT is set in wp-config.php, when your user is not an administrator, or when your host or a security plugin turns them off.
Many hosts and security plugins disable the editors on purpose. If an attacker gets into an admin account, the editors would let them run any code on your server.
The setting is documented in WordPress's wp-config.php guide. If it is turned on, view the files by FTP or your host's file manager instead.
WordPress.com sites on plans without plugin access do not show the editors either. There you can view page source and use browser tools, but not server files.
How do you see code by FTP or file manager?
Connect with an FTP client or open your host's file manager, then browse to wp-content/themes or wp-content/plugins and open any file in a text editor.
This is the safest way to work with code because you can download a copy before changing anything. If an edit breaks the site, you upload the original file to undo it.
Our guide on how to get FTP access to WordPress shows where to find your FTP details at common hosts.
Use a proper code editor such as VS Code rather than a word processor. Word processors add hidden formatting that breaks PHP files.
How do you see code errors in WordPress?
Turn on WordPress debug mode by adding WP_DEBUG and WP_DEBUG_LOG to wp-config.php, then read the debug.log file in wp-content to see PHP errors.
Browser tools show front-end errors, but PHP errors happen on the server. Debug mode writes them to a log so you can see the file and line number behind a problem.
Our guide on how to enable debug mode in WordPress walks through the settings. Turn debug display off on live sites so visitors do not see error messages.
Frequently asked questions
What is the shortcut for the code editor in WordPress?
In the block editor, press Ctrl+Shift+Alt+M on Windows or Cmd+Shift+Option+M on a Mac to switch between the visual editor and the code editor. Press the same keys again to return to the visual view.
Can I see the code of someone else's WordPress site?
You can see the front-end HTML, CSS and JavaScript of any site with View Page Source or developer tools. You cannot see their PHP files or database, because those stay on the server and are never sent to the browser.
Is it safe to edit code in the Theme File Editor?
It is risky. A single mistake in a PHP file can break the site, and there is no undo. Take a backup first, use a child theme, and prefer editing files by FTP so you can restore the original quickly.
Why does the code editor show comments like wp:paragraph?
Those comments are block markers. WordPress stores each block's type and settings in them and uses them to rebuild blocks in the editor. Leave them in place unless you want to remove or change that block.
How do I see which CSS is styling an element?
Right-click the element and choose Inspect. The developer tools highlight its HTML and list every CSS rule that applies, with the file name and line number, so you can see which stylesheet sets each style.
Sources
- WordPress Block Editor WordPress.org Documentation
- Appearance Theme File Editor Screen WordPress.org Documentation
- wp-config.php WordPress Developer Resources
- Open Chrome DevTools Chrome for Developers
- What are browser developer tools? MDN Web Docs
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


