Welcome to ManageWP.org

Register to share, discuss and vote for the best WordPress stories every day, find new ideas and inspiration for your business and network with other members of the WordPress community. Join the #1 WordPress news community!

×

What's your favorite function, and why?

Jul. 26, 2014

I'm always looking for handy new functions tucked deep down in WordPress core that I never knew about. What's your favorite function, and why?

Comment
28 votes   Flag
Kyle Maurer

Fun topic!

wp_enqueue_style() is great.
register_setting() makes things uber easy.
add_shortcode() I use constantly.
wp_remote_get() is amazing!
get_option() is so easy.
add_action()

Reply
JS Morisset

is_wp_error() - apparently it's not known by many. ;-)

Reply
William H

Not WP specific but I would die() without function_exists()

zeroise() is great when you need it

The only function more important than convert_smilies() is capital_P_dangit()

Reply
Mickey Kay

Just used this one for the first time in the pending update to my Better Font Awesome plugin. Loving it.

Reply
Michael Beil

Which function are you referencing Mickey?

Reply
Mickey Kay

is_wp_error is the one I'm talking about. Thought these comments were threaded :)

I've also been loving wp_parse_args() for handling defaults.

Reply
Josh Nederveld

using meta_query => array( array('key' => '_thumbnail_id') ) as part of get_posts makes sure you only get posts that have featured images set. very nice to not have to filter them out later.

Reply
Tim Nash

For William H (Since the comments are not threading today) augment die with wp_die it's die with style

Reply
Yoren Chang

wp_list_pluck is my favorite. Pretty handy when get an array of objects.

Reply
Uop Guide

thank

Reply
Jesper van Engelen

Definitely wp_remote_get... Unknown to most, but incredibly useful. codex.wordpress.org/Function_API/wp_remote_get

Reply
DhansuSeries

wp_remote_get() i sincerely love this.........

Reply
Mickey Kay

I have a love hate relationship with this one, as it doesn't consistently succeed across all server environments (I've had lots of issues with timeout errors). Would love to see/make a wrapper class that handles errors in a simple, reliable way.

Reply
Tom Harrigan

wp_list_filter() is a good one, similar to wp_list_pluck(), it lets you get a subset based on the value. Better explained in this blog post: jondavidjohn.com/wordpress-wp_list_pluck-and-wp_list_filter/

And a new presentation of little known WP functions: wordpress.tv/2014/08/11/kailey-lampert-hidden-treasures-of-wordpress/

Reply
Jan Hoek

Filter() is one of my favorites. You can great amazing layouts without touching the theme files.

Reply
Tom Harrigan

Where's that defined?

Reply
Olaf Lederer

I really like the conditional tags together with functions like wp_enqueue_script and wp_enqueue_style. The best I found this week was something like:
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'MyShortCode') ) { ... }

Reply
Tobias Schutter

WordPress is filled with little gems.
antispambot() for masking an emailaddress, human_time_diff() for a twitter like timestamp and wp_trim_words() for cropping large texts are great. You can find many small, but usefull ones, in wp-includes/formatting.php.

Reply