The do_feed_rdf() WordPress PHP function is used to load the RDF RSS 0.91 Feed template. It’s a part of WordPress’s comprehensive system to manage RSS feeds.
Usage
To use the do_feed_rdf() function, you simply need to call it. Here’s a quick example:
do_feed_rdf();
In this example, the function will load the RDF RSS 0.91 Feed template. There is no output as this function works in the backend to load the specified template.
Parameters
This function does not have any parameters.
More information
See WordPress Developer Resources: do_feed_rdf()
This function was introduced in WordPress version 2.1.0. It’s found in the wp-includes/functions.php
file.
Examples
Basic usage of the function
// Call the function to load the RDF RSS 0.91 Feed template do_feed_rdf();
This code will load the RDF RSS 0.91 Feed template.
Use within a conditional statement
if ( function_exists( 'do_feed_rdf' ) ) { do_feed_rdf(); }
This code checks if the do_feed_rdf() function exists, and if it does, it calls the function to load the RDF RSS 0.91 Feed template.
Customizing the feed template
// Change the default RDF feed template add_action( 'do_feed_rdf', 'my_custom_rdf_template', 10, 1 ); function my_custom_rdf_template() { get_template_part( 'my-rdf', 'feed' ); }
In this example, we are using the do_feed_rdf() function with the add_action
function to replace the default RDF RSS 0.91 Feed template with a custom one.
Removing the RDF feed
// Remove the RDF feed remove_action( 'do_feed_rdf', 'do_feed_rdf', 10, 1 );
In this example, the do_feed_rdf() function is used with the remove_action
function to completely remove the RDF RSS 0.91 Feed template.
Debugging the function
// Check if the function is working if ( has_action( 'do_feed_rdf' ) ) { echo 'The function do_feed_rdf() is working'; } else { echo 'The function do_feed_rdf() is not working'; }
In this example, we’re using the do_feed_rdf() function to check if the function is working. If the function is working, it will print “The function do_feed_rdf() is working”, otherwise it will print “The function do_feed_rdf() is not working”.