How to display WP Query filters?

There’s a global variable called $wp_filter (you can see examples of it all through the source of /wp-includes/plugin.php. This probably isn’t the WordPress Way to do it, but you could try something like this: global $wp_filter; var_dump( $wp_filter ); …but note the caveat on http://codex.wordpress.org/Global_Variables — “Accessing other globals besides the ones listed below is … Read more

write a post on user registration

Use the ‘user_register’ WordPress action to add the post function. Use wp_insert_post() to add the post. add_action( ‘user_register’, ‘wpse_99270_new_user_post’ ); /** * Add a new post when user registers. */ function wpse_99270_new_user_post( $user_id ) { // Get user data. $user_data = get_userdata( $user_id ); // Add new post here. wp_insert_post( array( ‘post_title’ => wp_strip_all_tags( sprintf( … Read more

Widget to show posts in the sidebar basing on its IDs

Try to replace ‘post__in’ => array($instance[‘postsToShow’]), with ‘post__in’ => explode(“,”, $instance[‘postsToShow’]), to feed the post__in with an array. Your current array looks like array(“123,456,789”) but should be like array(“123”, “456”, “789”)

SQL Bulk Move old posts by one author to another category

Try something like this: global $wpdb; $from_user = 2; $to_user = 5; $posts_table = $wpdb->prefix . ‘posts’; $users_table = $wpdb->prefix . ‘users’; $strQuery = “UPDATE `$posts_table` SET post_author = $to_user WHERE post_author = $from_user AND $posts_table.post_date < ’01/01/2013′ AND $wpdb->term_taxonomy.term_id IN (1,2,3) AND $wpdb->term_taxonomy.taxonomy = ‘category'”; echo $strQuery; $wpdb->query($strQuery); For more info please visit this … Read more

How to store array in usermeta in wordpress

Subtle difference in your name declaration, which needs to be name=”test[]”. <select name=”test[]” id=”test” multiple> <option value=”volvo”>Volvo</option> <option value=”saab”>Saab</option> <option value=”opel”>Opel</option> <option value=”audi”>Audi</option> </select> update_usermeta( $new_user, ‘test’, $_POST[‘test’] ); Edit re: your comment, $meta = get_user_meta($user_id, ‘test’); foreach ($meta as $key => $value) { echo $value; }

How to add PHP code snippet to all Post pages?

I recommend you use hooks to insert your code from functions.php instead of modifying a theme file. Otherwise you have to make the same change to the template every time you update the theme. http://codex.wordpress.org/Plugin_API/Action_Reference Many themes offers its own hooks so that you don’t have to code as much. For example, Genesis framework documentation … Read more

Open post within Foundation 3 Reveal

I’m not sure if you’re still working on this problem, and I’m using F4 so may not be exactly the same problem, but I combined Reveal with WP’s inbuilt AJAX to retrieve content. I’ll add the relevant sections of code below: Here’s the plugin code below: public function __construct() { self::$dir = plugin_dir_path( __FILE__ ); … Read more