WordPress Post Content Disappears

You are here:
Estimated reading time: 2 min

The Problem

The text in a WordPress post disappears when the post is published. The content shows in the editor but when you publish and view the post, there is nothing there except an image.

Usually, the first step techs recommend when troubleshooting WordPress issues is to deactivate plugins or change the theme to see if one of those is causing a conflict. But in this case, don’t waste time deactivating and reactivating. That won’t solve the problem.

This article explains why the post content disappears and how to fix it.

How WordPress File Naming Works

Every post, page, media file is created with a unique identifier, which in WordPress is called a slug. Unless you manually change it, the slug is identical to the title of the file minus the file extension (e.g. png, jpeg, php)

Where you get into trouble in WordPress is trying to name two items with the same slug. You may have noticed this if you create a post and WordPress keeps adding a -2 to the end of the URL. That means something else is already using that slug. Usually the culprit is a post or page in the trash. But in this case, that is not the cause.

No two items (post, page, image, category, tag, etc.) can share the same slug. Using the same slug can cause unexpected results.

How can File Names Make Post Content Disappear?

The clue when troubleshooting this problem is that the image appears when you view your post or page. Take note of the title of that image.

You can find the title of an image in the Media Library. In list view, the title is the clickable link next to the image thumbnail.

Most likely what you find is that the title of the image is the same as the slug of your post – the post slug is post-name and the image title is also post-name.

That’s why when you view the published page only the image shows up. You are viewing the page for that slug which in this case is the attachment page for the image, not your post.

Identical slug errors happen most often when content is bulk imported. For instance, when bulk importing HTML pages and images into WordPress.

How to Solve the Problem

The problem can be solved by changing the title of the image:

  1. Open the Media Library and find the problem image.
  2. Click the image to open the editing window.
  3. In the Title section, add -1 to the end of the image title (you can add anything, you just need to change the title somehow). The new title will be saved automatically.
  4. Press X to close the window.

Note: Do NOT change the URL in your post. It is only the title (slug) in the Media Library that needs to be changed.

Now view the published post to make sure the content and image both appear. Clear your cache, if needed.

Tags:

Reader Interactions

Leave a Reply

NOTICE: Permanently closing March 31, 2024. I will be working limited hours until then.