llms_post_content_init( callable $callback = 'llms_get_post_content', integer $priority = 10 )
Initialize LifterLMS post type content filters
Description Description
This method is used to determine whether or llms_get_post_content() should automatically be added as a filter callback for the WP core the_content filter.
When working with posts on the admin panel (during course building, importing) we don’t want other plugins that may desire running apply_filters( 'the_content', $content ) to apply our plugin’s filters.
Parameters Parameters
- $callback
-
(callable) (Optional) Callback function to be added as a callback for the filter
the_content. Default 'llms_get_post_content'.Default value: 'llms_get_post_content'
- $priority
-
(integer) (Optional) Priority used when adding the filter. Default: 10.
Default value: 10
Return Return
(boolean) Returns true if content filters are added and false if not.
Source Source
File: includes/functions/llms-functions-content.php
function llms_post_content_init( $callback = 'llms_get_post_content', $priority = 10 ) {
// Don't filter post content on the admin panel.
$should_filter = ( false === is_admin() );
/**
* Filters whether or not LifterLMS content filters should be applied.
*
* @since 4.17.0
*
* @param boolean $should_filter Whether or not to filter the content.
* @param callable $callback Callback function to be added as a callback for the filter `the_content`.
*/
if ( apply_filters( 'llms_should_filter_post_content', $should_filter, $callback ) ) {
return add_filter( 'the_content', $callback, $priority );
}
return false;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.17.0 | Introduced. |