Post title not displaying as recorded in the wp_posts table


I have a WordPress install in which the “post_title” field from the “wp_posts” table is not making it into the WP_Post->post_title variable.

So, for a given post in the wp_posts table that has a correct post_title value of say (retrieved via a direct MySQL query):

"My First Post"

Retrieving the post title via any basic WordPress method, such as:

<?php print the_title(); ?>

… or …

$this_post = get_post();
print $this_post->post_title; 

Instead of the post’s title I get something like:

"Category | Sitename"

(Where “Category” is something like “Articles” and “Sitename” is the site’s name)

The resulting string from querying the post’s tile is not the contents of the post_title field from the record in the wp_post table, ie. it’s NOT the post’s title.

I would expect to see the post’s title here because the documentation for the WP_Post object ( states that the post_title member contains the post’s title, however it clearly does not, it contains some other value.

I’ve searched for any references to a filter which might be rewriting the post title, but as of yet can find none.

How is it possible that WordPress might be returning something other than the actual post title when referencing the post title? Where else should I be looking?

, , , paulswanson 3 years 2020-04-07T20:50:52-05:00 0 Answers 101 views 0

Leave an answer