Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

render_block_core_latest_comments

Function Description:

Renders the `core/latest-comments` block on server.

Function Examples:

⚠️ Examples below are generated with GPT-3 once every hour. Do not take them too seriously.
Consider them as some extra input in your learning process - reason about them. Will it work? What could fail?
// Display the latest 5 comments in a block on a specific page
echo render_block_core_latest_comments( array(
    'postsToShow' => 5,
    'displayAvatar' => true,
    'displayDate' => true,
    'displayExcerpt' => false,
    'excerptLength' => 0,
    'displayPostTitle' => false,
) );
// Show the latest 3 comments with avatars and post titles in a sidebar widget
echo render_block_core_latest_comments( array(
    'postsToShow' => 3,
    'displayAvatar' => true,
    'displayDate' => false,
    'displayExcerpt' => false,
    'excerptLength' => 0,
    'displayPostTitle' => true,
) );
// Avoid displaying comments from a specific user ID in the block
echo render_block_core_latest_comments( array(
    'postsToShow' => 5,
    'displayAvatar' => true,
    'displayDate' => true,
    'displayExcerpt' => false,
    'excerptLength' => 0,
    'displayPostTitle' => false,
    'excludedUsers' => array( 123 ),
) );