Using WordPress ‘automatic_feed_links()’ PHP function

The automatic_feed_links() WordPress PHP function enables or disables the automatic outputting of general feed links.

Usage

This function is typically used in your theme’s functions.php file to enable or disable the output of general feed links. Here’s a simple example:

automatic_feed_links(false);

In this case, false is passed as an argument to the function, which means it will disable the automatic output of general feed links.

Parameters

  • $add (bool): Optional. Add or remove links. Default is true.

More information

See WordPress Developer Resources: automatic_feed_links()

This function has been deprecated as of WordPress 4.4.0. It’s recommended to use add_theme_support( 'automatic-feed-links' ) instead.

Examples

This example disables the automatic output of general feed links.

// Disabling automatic feed links
automatic_feed_links(false);

This example enables the automatic output of general feed links.

// Enabling automatic feed links
automatic_feed_links(true);

As automatic_feed_links() is deprecated, it’s recommended to use add_theme_support( 'automatic-feed-links' ) instead.

// Adding theme support for automatic feed links
add_theme_support('automatic-feed-links');

If you’ve used add_theme_support( 'automatic-feed-links' ) and you want to remove it, you can use remove_theme_support( 'automatic-feed_links' ).

// Removing theme support for automatic feed links
remove_theme_support('automatic-feed-links');

You can check if your theme supports automatic feed links using current_theme_supports( 'automatic-feed-links' ).

// Checking if the current theme supports automatic feed links
if (current_theme_supports('automatic-feed-links')) {
    echo "Automatic feed links are supported!";
} else {
    echo "Automatic feed links are not supported!";
}