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.
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.
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.
How to Solve the Problem
The problem can be solved by changing the title of the image:
- Open the Media Library and find the problem image.
- Click the image to open the editing window.
- 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.
- 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.