• Hi

    I’d like to get a post title as a plain string.

    Currently using:

    post.title.rendered

    Which is working great when I output to HTML,

    but I would also like to get the title as a plain string without the character encoding, so

    string = “Hyphen – in my post title’s”

    would be

    string = “Hyphen – in my post title’s”

    Have you any advice on how to do this please? I’m not sure if I need to do some decoding in JavaScript or access the title differently.

    P.s. my specific need is to include the post title when building up social media URL’s, and the & are causing problems.

    Many Thanks
    JRW

The topic ‘Post Title Rendered’ is closed to new replies.