The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

how to add category title into a post (2 posts)

  1. shortbus1662
    Posted 8 years ago #

    I want to make a post but dynamically insert the category title of the page the post falls under into the body of the post.

    Is there a way to insert the category title, post title, category slug, etc., into the post?

    I'd really appreciate any information that anyone can provide.

  2. bekabug
    Posted 8 years ago #

    Forgive me, but I don't see how this could be useful. You can much more easily add this information into a post meta area.

    That said...

    I have used the runPHP plugin (2.3.3 as of right now) to execute PHP in posts. You could, in theory (i haven't tested this) run something like:

    foreach((get_the_category()) as $category) {
        echo $category->cat_name . ' ';

    ...in a post. If you didn't want to have to remember the code all the time you could modify your quicktags and make a new button for it.

Topic Closed

This topic has been closed to new replies.

About this Topic