Using WordPress ‘atom_comments_ns’ PHP action

The atom_comments_ns WordPress action fires inside the feed tag in the Atom comment feed.

Usage

add_action('atom_comments_ns', 'your_custom_function');
function your_custom_function() {
    // Your custom code here
}

Parameters

  • None

More information

See WordPress Developer Resources: atom_comments_ns

Examples

Add custom namespace to Atom comment feed

Add a custom namespace to the Atom comment feed.

add_action('atom_comments_ns', 'add_custom_namespace');
function add_custom_namespace() {
    echo 'xmlns:custom="http://example.com/custom-namespace"';
}

Add multiple custom namespaces

Add multiple custom namespaces to the Atom comment feed.

add_action('atom_comments_ns', 'add_multiple_namespaces');
function add_multiple_namespaces() {
    echo 'xmlns:custom1="http://example1.com/custom-namespace" ';
    echo 'xmlns:custom2="http://example2.com/custom-namespace"';
}

Add Dublin Core namespace

Add the Dublin Core namespace to the Atom comment feed for enhanced metadata.

add_action('atom_comments_ns', 'add_dublin_core_namespace');
function add_dublin_core_namespace() {
    echo 'xmlns:dc="http://purl.org/dc/elements/1.1/"';
}

Add a custom attribute to the Atom comment feed

Add a custom attribute to the Atom comment feed.

add_action('atom_comments_ns', 'add_custom_attribute');
function add_custom_attribute() {
    echo 'custom-attribute="value"';
}

Add RDFa namespace to Atom comment feed

Add an RDFa namespace to the Atom comment feed for better semantic markup.

add_action('atom_comments_ns', 'add_rdfa_namespace');
function add_rdfa_namespace() {
    echo 'xmlns:rdfa="http://www.w3.org/ns/rdfa#"';
}