tribe_get_the_content( string $more_link_text = null, bool $strip_teaser = false, WP_Post|object|int $post_id = null )
Gets the post content. Basically a wrapper around get_the_content
that will prevent warnings on PHP 7.3 and be compatible with WP 5.3
Contents
Parameters
- $more_link_text
-
(string) (Optional) Content for when there is more text.
Default value: null
- $strip_teaser
-
(bool) (Optional) Strip teaser content before the more text. Default is false.
Default value: false
- $post_id
-
(WP_Post|object|int) (Optional) WP_Post instance or Post ID/object. Default is null.
Default value: null
Return
(string)
Source
File: src/functions/template-tags/post.php
function tribe_get_the_content( $more_link_text = null, $strip_teaser = false, $post_id = null ) { global $post, $wp_version; // Save the global post to be able to restore it later. $previous_post = $post; $post = get_post( $post_id ); // Pass in the third param when dealing with WP version 5.2 or higher. if ( version_compare( $wp_version, '5.2', '>=' ) ) { $content = get_the_content( $more_link_text, $strip_teaser, $post ); } else { $content = get_the_content( $more_link_text, $strip_teaser ); } /** * Filters the post content. * * @since 0.71 of WordPress * * @param string $content Content of the current post. */ $content = apply_filters( 'the_content', $content ); $content = str_replace( ']]>', ']]>', $content ); $post = $previous_post; return $content; }
Changelog
Version | Description |
---|---|
4.9.23 | Introduced. |