Function and usage of automatic_feed_links() in wordpress


Answers ( 1 )


    The automatic_feed_links() function in WordPress is used to enable or disable the automatic output of general feed links in a theme. This function is a part of WordPress’s theme support features and is particularly useful for theme developers who want to control the presence of feed links in their themes.

    Function Syntax:

    automatic_feed_links( bool $add = true )


    • The automatic_feed_links() function allows a theme to support or not support automatic feed links. This is useful for adding or removing RSS, Atom, or RDF feed links to your WordPress site's head.
    • It works in conjunction with the add_theme_support() function, which is used to register theme support for certain features in WordPress.


    • $add (bool) (optional): This parameter specifies whether to add or remove the feed links.
      • If set to true, it enables the automatic output of general feed links.
      • If set to false, it disables this feature.
      • The default value is true.

    Usage Example:

    1. Enabling Automatic Feed Links: To enable automatic feed links in your theme, you would add the following line to your theme's functions.php file:

      add_theme_support( 'automatic-feed-links' );
    2. Disabling Automatic Feed Links: If you want to disable automatic feed links, you can set the $add parameter to false:

      automatic_feed_links( false );

    Important Notes:

    • It's recommended to use add_theme_support( 'automatic-feed-links' ) instead of automatic_feed_links() directly, as the former is more widely used and understood in the WordPress developer community.
    • This function is typically called within the after_setup_theme action hook in your theme’s functions.php file.
    • It is important for theme developers to consider the use of this function in the context of the overall design and functionality of the theme.


    The automatic_feed_links() function is a simple yet powerful tool for WordPress theme developers. It provides control over the inclusion of feed links in the site's head, which can be important for site performance and meeting specific design requirements.

Leave an answer