WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ryanve
    Member
    Posted 1 year 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