WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Function for formatting attributes from an array? (1 post)

  1. ryanve
    Member
    Posted 3 years ago #

    Does WP (or native PHP) have a built-in function for formatting attributes from an array? For example something to the effect of:

    echo attr_encode(array(
        'id' => 'example'
      , 'class' => array('a', 'b', 'c')
    ));

    which would output:

    id="example" class="a b c"

    I looked thru wp-includes/kses.php but didn't find this exact functionality.

Topic Closed

This topic has been closed to new replies.

About this Topic