Notifications
Clear all

Limited Support

Our support team is currently on holiday from December 25, 2025 to January 7, 2026, and replies may be delayed during this period.

We appreciate your patience and understanding while our team is away. Thank you for being part of the wpForo community!

Merry Christmas and Happy Holidays! 🎄

[Solved] I want to get the body of the post

8 Posts
3 Users
1 Reactions
2,204 Views
Posts: 6
Topic starter
(@gocchimama)
Active Member
Joined: 2 years ago

I can get the post title, username and post URL as below, but not the body.
Please give me advice on how to write it.

    $author_id = $post['userid']; 
    $author_name = get_the_author_meta('display_name', $author_id);

    $topic = wpforo_topic($post['topicid']);
    $topic_url = $topic['url'];

    $send_title = esc_html( $post['title'] );

7 Replies
Tutrix
Posts: 1521
(@tutrix)
Noble Member
Joined: 6 years ago

Hi @gocchimama

try

esc_html( wpforo_text( $post['body']) )

or

esc_html( wpforo_content_filter( $post['body']) )

Posts: 6
Topic starter
(@gocchimama)
Active Member
Joined: 2 years ago

Thank you !

i tried it ,but it didn't work...


2 Replies
Tutrix
(@tutrix)
Joined: 6 years ago

Noble Member
Posts: 1521

@gocchimama 

I am using the above codes for a mouseover post preview e.g. in the widgets and it works there.


BlackRaz
Admin
(@blackraz)
Joined: 9 years ago

Contributor
Posts: 395

@gocchimama 

Try this code for getting body

wpforo_content( $post, false );

Posts: 6
Topic starter
(@gocchimama)
Active Member
Joined: 2 years ago

Thank you !

But,I couldn't get it. When I look at the debug, the body does not exist in the array.

Array
(
[topicid] => 37
[forumid] => 2
[first_postid] => 42
[userid] => 1
[title] => this title
[slug] => %e3%81%95%e3%82%89%e3%81%ab%e3
[created] => 2023-07-2608:55:34
[modified] => 2023-07-2608:55:34
[last_post] => 42
[posts] => 1
[votes] => 0
[answers] => 0
[views] => 0
[meta_key] =>
[meta_desc] =>
[type] => 0
[solved] => 0
[closed] => 0
[has_attach] => 0
[private] => 0
[status] => 0
[name] =>
[email] =>
[prefix] =>
[tags] =>
[url] =>  http://forum.local/xxx 
[full_url] =>  http://forum.local/xxx 
[short_url] =>  http://forum.local/topicid/37/ 
)
 
How can I add the 'body' to the array?

BlackRaz
Posts: 395
Admin
(@blackraz)
Contributor
Joined: 9 years ago

@gocchimama
You can use this function e.g.

wpforo_topic( $post['topicid'], 'body' )

Page 1 / 2