Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

feed_content_type

Function Description:

Returns the content type for specified feed type.

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?
// Example 1: Setting the feed content type to 'application/json'
add_action( 'init', 'custom_feed_content_type' );
function custom_feed_content_type() {
    feed_content_type( 'application/json' );
}
// Example 2: Checking the current feed content type before setting a new one
$current_content_type = feed_content_type();
if ( $current_content_type !== 'application/json' ) {
    feed_content_type( 'application/json' );
}
// Example 3: Resetting the feed content type back to default
add_action( 'init', 'reset_feed_content_type' );
function reset_feed_content_type() {
    feed_content_type( '' );
}