How to display specific posts with WP_Query?

Could be because you are passing an array of array try this: <?php $my_query = new WP_Query(); $my_query->query(array( ‘post__in’ => $curauth->user_favourite_post)); while ($my_query->have_posts()) : $my_query->the_post(); ?> <h3><a href=”https://wordpress.stackexchange.com/questions/27808/<?php the_permalink(); ?>”><?php the_title(); ?></a></h3> <?php endwhile; ?>

How to tell whether a user meta value has increased or decreased [closed]

I would solve this creating two extra Custom Fields: _score_last _score_variation The first underscore makes the CF invisible in the Admin area. Drop the following code in your theme’s functions.php: if( is_admin() ) { add_action( ‘save_post’, ‘wpse_57217_check_customfield_variation’, 11, 2 ); } function wpse_57217_check_customfield_variation( $post_id, $post ) { if ( ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE … Read more

Get the Google+ and Twitter links – WordPress SEO plugin

I found a way to do it in author.php file Just use the following to display the Google+ and Twitter links: <?php $curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); echo $curauth->googleplus; echo $curauth->twitter; ?>

Query users by capability – uninstall/deactivate callback

It was actually much easier than I originally thought – just doing a WP_User_Query for a meta value (meta arrays are supported as well, like for the other query classes). public function on_deactivate() { $meta_key = ‘tools_page_tsi_per_page’; $query = new WP_User_Query( array( ‘meta_key’ => $meta_key ) ); if ( empty( $query->results ) ) return; foreach … Read more