title: How do I prevent Plugin updates from clobbering user edits?

text: How can I prevent my plugin updates from clobbering the user edits and file additions in a particular subdirectory of my plugin? I wrote a syntax highlighting plugin that makes use of GeSHi. A sub folder of the plugin is GeSHi itself. Many users will want to customize / edit the language files within GeSHi. Specifically here is the directory structure:   * wp-contente/plugins/my-plugin/      * several subdirectories etc   * wp-content/plugins/my-plugin/geshi/geshi/      * users are going to add files to this directory     * they will also edit files in this directory     * when they pick up their new updates I don't want to erase their edits What's the best way of solving this? Thanks! * * * Here's what I was thinking, but I don't know how to implement:   1. On the update plugin action hook (?) make a temporary copy of the files I want to preserve.   2. Get the new version unzip and install like usual   3. Copy the preserved files from the temp copy to the new version   4. Remove the temp copy Ideally this would all be done with files, but worst case scenario I could save data to the DB. Problem is I don't see hooks for plugin updates. I looked here and here.


title: Is there a maximum number of author for a blog?

text: I am building a WP blog which will feature the work of many artists and I would like to show, for each post, the artist bio. Since it is possible for an artist to have many posts over time on the blog, I don't want to insert the bio info directly inside the post and instead use a custom function to show it. This is why I was thinking about using the author meta data to store the info about the artist. Doing this brings 2 questions:   1. is there a hard limit to the number of authors (or reason not have a lot of authors)   2. is there a reason not to do it this way? (or a better way to do it)


title: Log Author Actions

text: Is there a place where actions like post creation/deletion, page creation/deletion, modification, etc. is saved? Is this stored in the Apache logs? If this is not saved, is there a way (plugin?) to do this?


title: Is there a plugin that will facilitate displaying a website (static pages, not a blog) content in two languages

text: I am looking for the easiest way to display the content of a single website in two different languages, do not need translation, I do have my own translation. I just want to display the same pages, but in one set in English and the other in Spanish. Could anyone guide me on how to achieve it? Is there a plugin that will allow me to just retype the content and use the same pictures, layout, etc.??


title: How to force "remember me" users to login again?

text: My question is how to force the users that are auto-logged in because they previously checked "remember me" to log in again? It may be something with cookies, but is there anything I can change/modify to do this ? Thank you. **UPDATE** Generally, using jQuery cookie plugin, the code that checks for a cookie in user's system looks like this.               $(document).ready(function(){     if(!$.cookie('name-of-cookie')){         $.cookie('name-of-cookie', 'true', { expires: 2});     .     .     }      Is there any similar in Wordpress to handle this?


title: WP admin bar disappeared

text: The admin bar suddenly disappeared from the front end side of my site. It is present and works alright at the backend. I thought it could be due to some plugin so I deactivated them one by one and checked . Now all the plugins are deactivated and the admin bar is still missing...My theme does have the `wp_footer()` in footer.php. What is it that I am missing?


title: Manually installed plugin doesn't show up

text: I installed a plugin called hide-title by unzipping it and copying the files to the plugins dir. But it doesn't show up in the plugin list. I've checked the following:   * the plugin's main php file looks fine at a glance, it has the required header   * there's no double nesting problem such as "plugins/hide-title/hide-title/..."   * I've tried chmod -R 777 wp-content   * The plugin is compatible with my wordpress version   * I'm not working in a wrong dir - I tried, for example, renaming the twentyten theme to twentyten_ and that got reflected in the dashboard It seems to be a more general problem because I also tried installing a theme and got the same problem. I don't want to install the stuff via the dashboard UI because I had FTP/permissions problems with that and gave up on it.


title: shortcode - I need to throw a message or load a different page

text: I am displaying a form on the public side using shortcode.The shortcode is included on Post add_new, located at `http://localhost/wordpress/add_new/`. On successful saving of form data, I need the page to either 1) change the page's location and show a message of successful completion, or show a message of successful completion on page add_new. This is my shortcode:               add_shortcode( 'show_INT_form', function() {         $int_class = new int_class;              if ( isset( $_REQUEST['int_prefix'] ) && isset( $_REQUEST['int_suffix'] ) ) {              // ???? Area X             // What do I do here?             // ????         }         else {             $ret = $int_class->public_form(); // function that loads the form onto the page         }              return $ret;     } );      How can I have the add_new page load another page? I have seen sample code simply echoing `<meta http-equiv='refresh' content='0;url=page_to_load' />` in **Area X** located in the comments in the code above. I have tried this, and it works, but is this proper procedure? I have not tried other methods since I don't know how to work around the function and class scope. How could I call a new event listener (such as `add_action( 'send_headers' )` ) outside of my add_shortcode function and pass it an argument, such as a 'success' or 'error' message?


title: how to make stylesheet appear in theme editor?

text: I have a stylesheet in my theme in the css subdir of the theme dir (`css/style.css`). The question is how to make this .css file appear in the theme editor of the WordPress admin. (I know using the web editor is a bad idea and I never use it, but the client specifically asked for this). Note: the only css file that shows up by default in my theme editor is 'style.css' of the root theme dir, but this is not what I need.


title: Search doesn't work with 'relation' => 'OR'

text: **Records in the Database:** 5 **The Problem:** This code takes long to search 5 records and hangs up after with no success results. If I change the `'relation' => 'OR'` to `'relation' => 'AND'` it works but that's not what am looking for in this scenario. **_Is everything okay in my code?_**               <?php     $args = array(         'post_type' => 'shipping-schedules',          'posts_per_page' => 5,         'post_status' => 'publish',         'paged' => $paged,         'meta_query' => array(         'relation' => 'OR',             array(                 'key' => 'schedules_port',                 'value' => $sfrom,                 'compare' => 'LIKE'             ),             array(                 'key' => 'schedules_port',                 'value' => $sto,                 'compare' => 'LIKE'             ),             array(                 'key' => 'schedules_vessel',                 'value' => $svessel,                 'compare' => 'LIKE'             ),             array(                 'key' => 'schedules_voyage',                 'value' => $svoyage,                 'compare' => 'LIKE'             ),             array(                 'key' => 'schedules_arrival',                 'value' => $sdate_arrival,                 'compare' => '>=',                 'type' => 'NUMERIC'             ),             array(                 'key' => 'schedules_departure',                 'value' => $sdate_departure,                 'compare' => '<=',                 'type' => 'NUMERIC'             )         )     );                                   ?>


title: the_widget() inside functions.php

text: I'm setting some options in the backend using functions.php and I'm doing:               $w = the_widget('My_Custom_Widget');      but I don't get any output. However doing               <?php the_widget('My_Custom_Widget'); ?>      on any page template works fine. How can I do this?


title: Sitewide Tags and Transient API

text:
I'm running a couple of multisite networks and am using a useful plugin called WordPress MU Sitewide Tags Pages. I like the plugin very much but I am concerned about performance, especially as my networks generate more simultaneous users and get larger in terms of number of subsites. I would like to use the Transients API to give the plugin some added performance, but despite my best research, I have not found any useful direction on where to start. I'm wondering if the plugin itself would need adjusting, or if the loop in my theme would need adjusting. I'm using a standard loop. Would it make more sense to cache this loop or cache a custom WP_Query variable? I know the plugin is over 500 lines long, but I thought it would be instructive start a conversation on how to best apply Transients API to the plugin. Here is the plugin:               <?php     /*     Plugin Name: WordPress MU Sitewide Tags Pages     Plugin URI: http://ocaoimh.ie/wordpress-mu-sitewide-tags/     Version: 0.4.2     Author: Donncha O Caoimh     Author URI: http://ocaoimh.ie/     */     /*  Copyright 2008 Donncha O Caoimh (http://ocaoimh.ie/)         With contributions by Ron Rennick(http://wpmututorials.com/), Thomas Schneider(http://www.im-web-gefunden.de/) and others.     */          function swt_add_pages() {         global $wpmu_version, $wp_version;         if ( version_compare( $wp_version, '3.0.9', '<=' ) && version_compare( $wp_version, '3.0', '>=' ) && is_multisite() && is_super_admin() ) {             add_submenu_page( 'ms-admin.php', 'Sitewide Tags', 'Sitewide Tags', 'manage_options', 'sitewidetags', 'swt_manager' );         } elseif ( isset( $wpmu_version ) && is_site_admin() ) {             add_submenu_page( 'wpmu-admin.php', 'Sitewide Tags', 'Sitewide Tags', 'manage_options', 'sitewidetags', 'swt_manager' );         }     }     add_action('admin_menu', 'swt_add_pages');          function swt_network_add_pages() {         add_submenu_page( 'settings.php', 'Sitewide Tags', 'Sitewide Tags', 'manage_options', 'sitewidetags', 'swt_manager' );     }     add_action('network_admin_menu', 'swt_network_add_pages');          function swt_text_domain() {         load_muplugin_textdomain( 'wpmu-sitewide-tags', MUPLUGINDIR . '/languages' );     }     add_action( 'init', 'swt_text_domain' );          function swt_manager() {         echo '
';         if( !empty( $_REQUEST['updated'] ) && '1' == $_REQUEST['updated'] )              echo '

' . __( 'Settings updated.', 'wpmu-mu-sitewide-tags' ) . '

';              echo '
' . __( 'Global Tags', 'wpmu-sitewide-tags' ) . '
';         echo '<form name="global_tags" action="" method="post">';         echo '<input type="hidden" name="action" value="sitewidetags" />';         wp_nonce_field('sitewidetags');         if( get_sitewide_tags_option( 'tags_blog_public' ) === null )             add_site_option( 'sitewide_tags_blog', array( 'tags_blog_public' => 1 ) );              $tags_blog_enable = get_sitewide_tags_option( 'tags_blog_enabled' );         ?>

                 <?php _e('Tags Blog','wpmu-sitewide-tags') ?>	                                       <input name="tags_blog_enabled" type="checkbox" id="tags_blog_enabled" value="1" <?php if( $tags_blog_enable == 1 ) { echo "checked='checked'"; } ?> /> <?php _e("Enabled","wpmu-sitewide-tags"); ?>
         <?php         if( !$tags_blog_enable ) {             echo "

<input class='button-primary' type='submit' value='" . __( 'Update Settings', 'wpmu-mu-sitewide-tags' ) . "' />
                 </form>
";             return false;         }         $tags_blog_public = get_sitewide_tags_option( 'tags_blog_public' );         $tags_blog_pages = get_sitewide_tags_option( 'tags_blog_pages' );         $tags_blog_thumbs = get_sitewide_tags_option( 'tags_blog_thumbs' );         $tags_blog_pub_check = get_sitewide_tags_option( 'tags_blog_pub_check' );         $tags_blog_postmeta = get_sitewide_tags_option( 'tags_blog_postmeta' );         ?>
<?php _e( "You can create your post archive in a specific 'tags' blog of your choosing, or you can use the main blog of your site. Each has it's own pros and cons.","wpmu-sitewide-tags"); ?>

<input name="tags_blog" type="text" id="tags_blog" style="width: 35%" value="<?php echo esc_attr( get_sitewide_tags_option( 'tags_blog', 'tags' ) ); ?>" size="45" />
         <?php _e('Blogname of the blog your global tags and posts will live in. Blog will be created.','wpmu-sitewide-tags') ?>

<input name="tags_blog_main_blog" type="checkbox" id="tags_blog_main_blog" value="1" <?php if( get_sitewide_tags_option( 'tags_blog_main_blog', 0 ) == 1 ) { echo "checked='checked'"; } ?> /> <?php _e( "Post to main blog","wpmu-sitewide-tags" ); ?>
         <?php _e('Create posts in your main blog. All posts will appear on the front page of your site. Remember to to add a post loop to home.php in the theme directory if it exists.','wpmu-sitewide-tags') ?>

                 <?php _e('Max Posts','wpmu-sitewide-tags') ?>	                                       <input name="tags_max_posts" type="text" id="tags_max_posts" style="width: 15%" value="<?php echo intval( get_sitewide_tags_option( 'tags_max_posts', 5000 ) ); ?>" size="5" />
                     <?php _e('The maximum number of posts stored in the tags blog.','wpmu-sitewide-tags') ?>

                 <?php _e('Include Pages','wpmu-sitewide-tags') ?>	                                       <input name="tags_blog_pages" type="checkbox" id="tags_blog_pages" value="1" <?php if( $tags_blog_pages == 1 ) { echo "checked='checked'"; } ?> /> <?php _e("Enabled","wpmu-sitewide-tags"); ?>

                 <?php _e('Include Post Thumbnails','wpmu-sitewide-tags') ?>	                                       <input name="tags_blog_thumbs" type="checkbox" id="tags_blog_thumbs" value="1" <?php if( $tags_blog_thumbs == 1 ) { echo "checked='checked'"; } ?> /> <?php _e("Enabled","wpmu-sitewide-tags"); ?>

                 <?php _e('Privacy','wpmu-sitewide-tags') ?>	                                       <input type='radio' name='tags_blog_public' value='1' <?php echo ( $tags_blog_public == 1 ? 'checked="checked"' : '' ) ?> /> <?php _e('Tags pages can be indexed by search engines.','wpmu-sitewide-tags')?>
                     <input type='radio' name='tags_blog_public' value='0' <?php echo ( $tags_blog_public == 0 ? 'checked="checked"' : '' ) ?> /> <?php _e('Tags pages will not be indexed by search engines.','wpmu-sitewide-tags')?>
                     <?php _e('Will your tags pages be visible to Google and other search engines?','wpmu-sitewide-tags');             if( $tags_blog_public == 1 ) { ?>                     <input name="tags_blog_pub_check" type="hidden" value="0" />      <?php } else { ?>

                 <?php _e('Non-Public Blogs','wpmu-sitewide-tags') ?>	                                       <input name="tags_blog_pub_check" type="checkbox" id="tags_blog_pub_check" value="1" <?php if( $tags_blog_pub_check == 1 ) { echo "checked='checked'"; } ?> /> <?php _e("Enabled","wpmu-sitewide-tags"); ?>
                     <?php _e('Include posts from blogs not indexed by search engines.','wpmu-sitewide-tags');              } ?>
                      <?php _e('Post Meta') ?>	                                               <textarea name="tags_blog_postmeta" id="tags_blog_postmeta" cols='40' rows='5'><?php echo $tags_blog_postmeta == '' ? '' : @implode( "\n", $tags_blog_postmeta ); ?></textarea>
                         <?php _e('If you want to copy custom fields with posts. One custom field per line.') ?>

<input class='button-primary' type='submit' value='<?php _e( 'Update Settings', 'wpmu-mu-sitewide-tags' ) ?>' />
         </form>         <?php         echo '<form name="global_tags" action="" method="GET">';         echo "<input type='hidden' name='page' value='sitewidetags' />";         echo "<input type='hidden' name='action' value='populateblogs' />";         wp_nonce_field('sitewidetags');         ?>

                 <?php _e('Populate Posts','wpmu-sitewide-tags') ?>	                                       <?php printf( __( 'Blog ID: %s OR', 'wpmu-sitewide-tags' ), '<input name="populate_blog" type="text" id="populate_blog" style="width: 15%" value="" size="5" />' ); ?>
                     <input name="populate_all_blogs" type="checkbox" id="populate_all_blogs" value="1" /> <?php _e( 'All blogs', 'wpmu-sitewide-tags' ); ?>
                     <?php _e( 'Add posts from the blog named above or all blogs to the sitewide tags blog. This page will reload while copying the posts and may take a long time to finish.', 'wpmu-sitewide-tags' ) ?>
                     <?php _e( 'Note: Depending on your server resources, you may need to turn off other plugins while using the populate feature.', 'wpmu-sitewide-tags' ) ?>

<input class='button-primary' type='submit' value='<?php _e( 'Poplate Posts', 'wpmu-mu-sitewide-tags' ) ?>' />
         </form>
         <?php     }          function sitewide_tags_update_options() {         global $wpdb, $current_site, $current_user, $wp_version;              $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'sitewidetags') : false;         if ( !$valid_nonce )             return false;              if ( $_GET[ 'action' ] == 'populateblogs' ) {             $id = isset( $_GET[ 'populate_blog' ] ) ? (int)$_GET[ 'populate_blog' ] : 0;             $c = isset( $_GET[ 'c' ] ) ? (int)$_GET[ 'c' ] : 0; // blog count             $p = isset( $_GET[ 'p' ] ) ? (int)$_GET[ 'p' ] : 0; // post count             $all = isset( $_GET[ 'all' ] ) ? (int)$_GET[ 'all' ] : 0; // all blogs                  if  ( $id == 0 && isset( $_GET[ 'populate_all_blogs' ] ) ) // all blogs.                 $all = 1;                  $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );             if( !$tags_blog_id )                 return false;                  if( $all )                 $blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id DESC LIMIT %d,5", $c ) );             else                 $blogs = array( $id );                  foreach( $blogs as $blog ) {                 if( $blog != $tags_blog_id ) {                     $details = get_blog_details( $blog );                     $url = add_query_arg( array( 'p' => $p, 'action' => 'sitewidetags-populate', 'key' => md5( serialize( $details ) ) ), $details->siteurl );                     $p = 0;                     $post_count = 0;                          $result = wp_remote_get( $url );                     if( isset( $result['body'] ) )                         $post_count = (int)$result['body'];                          if( $post_count ) {                         $p = $post_count;                         break;                     }                 }                 $c++;             }             if( !empty( $blogs ) && ( $all || $p ) ) {                 if ( version_compare( $wp_version, '3.0.9', '<=' ) && version_compare( $wp_version, '3.0', '>=' ) )                     $url = admin_url( 'ms-admin.php' );                 else                     $url = network_admin_url( 'settings.php' );                      wp_redirect( wp_nonce_url( $url , 'sitewidetags' ) . "&page=sitewidetags&action=populateblogs&c=$c&p=$p&all=$all" );                 die();             }             wp_die( 'Finished importing posts into tags blogs!' );               }              if( !$_POST[ 'tags_blog_enabled' ] ) {             if( get_sitewide_tags_option( 'tags_blog_enabled' ) != $_POST[ 'tags_blog_enabled' ] )                  update_sitewide_tags_option( 'tags_blog_enabled', 0, true );             wp_redirect( add_query_arg( array( 'updated' => '1' ) ) );             exit;         }         update_sitewide_tags_option( 'tags_blog_enabled', 1 );              if( ( isset( $_POST[ 'tags_blog' ] ) || isset( $_POST[ 'tags_blog_main_blog' ] ) ) && isset( $_POST[ 'tags_blog_public' ] ) ) {             if( $_POST[ 'tags_blog_main_blog' ] == 1 ) {                 if( $current_site->blog_id )                     $id = $current_site->blog_id;                 else                     $id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain = '{$current_site->domain}' AND path = '{$current_site->path}'" );                 if( $id ) {                     update_sitewide_tags_option( 'tags_blog_id', $id );                     update_sitewide_tags_option( 'tags_blog_main_blog', 1 );                 } else {                     update_sitewide_tags_option( 'tags_blog_main_blog', 0 );                 }             } else {                 update_sitewide_tags_option( 'tags_blog_main_blog', 0 );                 $tags_blog = $_POST[ 'tags_blog' ];                 update_sitewide_tags_option( 'tags_blog', $tags_blog );                 if( constant( 'VHOST' ) == 'yes' ) {                     $domain = $tags_blog . '.' . $current_site->domain;                     $path = $current_site->path;                 } else {                     $domain = $current_site->domain;                     $path = trailingslashit( $current_site->path . $tags_blog );                 }                 $tags_blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain = '$domain' AND path = '$path'" );                 if( $tags_blog_id ) {                     update_sitewide_tags_option( 'tags_blog_id', $tags_blog_id );                 } else {                     $wpdb->hide_errors();                     $id = wpmu_create_blog( $domain, $path, __( 'Global Posts','wpmu-sitewide-tags' ), $current_user->id , array( "public" => $_POST[ 'tags_blog_public' ] ), $current_site->id);                     update_sitewide_tags_option( 'tags_blog_id', $id );                     $wpdb->show_errors();                 }             }             $tags_blog_public = (int)$_POST[ 'tags_blog_public' ];             update_sitewide_tags_option( 'tags_blog_public', $tags_blog_public );             update_blog_option( $tags_blog_id, 'blog_public', $tags_blog_public );             update_blog_status( $tags_blog_id, 'public', $tags_blog_public);         }              if( isset( $_POST[ 'tags_max_posts' ] ) )             update_sitewide_tags_option( 'tags_max_posts', (int)$_POST[ 'tags_max_posts' ] );              if( get_sitewide_tags_option( 'tags_blog_pages' ) != $_POST[ 'tags_blog_pages' ] )             update_sitewide_tags_option( 'tags_blog_pages', (int)$_POST[ 'tags_blog_pages' ] );              if( get_sitewide_tags_option( 'tags_blog_thumbs' ) != $_POST[ 'tags_blog_thumbs' ] )             update_sitewide_tags_option( 'tags_blog_thumbs', (int)$_POST[ 'tags_blog_thumbs' ] );              if( get_sitewide_tags_option( 'tags_blog_pub_check' ) != $_POST[ 'tags_blog_pub_check' ] ) {             if( $tags_blog_public == 0 )                 update_sitewide_tags_option( 'tags_blog_pub_check', (int)$_POST[ 'tags_blog_pub_check' ] );             else                 update_sitewide_tags_option( 'tags_blog_pub_check', 0 );         }              if( $_POST['tags_blog_postmeta'] != '' ) {             $meta_keys = split( "\n", stripslashes( $_POST[ 'tags_blog_postmeta' ] ) );             foreach( (array) $meta_keys as $key ) {                 $keys[] = trim( $key );             }             update_sitewide_tags_option( "tags_blog_postmeta", $keys );         } else {             update_sitewide_tags_option( "tags_blog_postmeta", '' );         }              // force write if changes saved         update_sitewide_tags_option( true );         wp_redirect( add_query_arg( array( 'updated' => '1' ) ) );         exit;     }     if ( !empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'sitewidetags' )         add_action( 'admin_init', 'sitewide_tags_update_options' );     /*     run populate function in local blog context because get_permalink does not produce the correct permalinks while switched     */     function sitewide_tags_populate_posts() {         global $wpdb;              $valid_key = isset( $_REQUEST['key'] ) ? $_REQUEST['key'] == md5( serialize( get_blog_details( $wpdb->blogid ) ) ) : false;         if ( !$valid_key )             return false;              $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );         $tags_blog_enabled = get_sitewide_tags_option( 'tags_blog_enabled' );              if( !$tags_blog_enabled || !$tags_blog_id || $tags_blog_id == $wpdb->blogid )             exit( '0' );              $posts_done = 0;         $p = isset( $_GET[ 'p' ] ) ? (int)$_GET[ 'p' ] : 0; // post count         while ( $posts_done < 300 ) {             $posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' LIMIT %d, 50", $p + $posts_done ) );                  if ( empty( $posts ) )                  exit( '0' );                  foreach ( $posts as $post ) {                 if ( $post != 1 && $post != 2 )                     sitewide_tags_post( $post, get_post( $post ) );                  }             $posts_done += 50;         }         exit( $posts_done );     }     if ( !empty( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'sitewidetags-populate' )         add_action( 'init', 'sitewide_tags_populate_posts' );          function sitewide_tags_post( $post_id, $post ) {         global $wpdb;              if( !get_sitewide_tags_option( 'tags_blog_enabled' ) )             return;              // wp_insert_category()         include_once(ABSPATH . 'wp-admin/includes/admin.php');              $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );         if( !$tags_blog_id || $wpdb->blogid == $tags_blog_id )             return;              $allowed_post_types = apply_filters( 'sitewide_tags_allowed_post_types', array( 'post' => true ) );         if ( !$allowed_post_types[$post->post_type] )              return;              $post_blog_id = $wpdb->blogid;         $blog_status = get_blog_status($post_blog_id, "public");         if ( $blog_status != 1 && ( $blog_status != 0 || get_sitewide_tags_option( 'tags_blog_public') == 1 || get_sitewide_tags_option( 'tags_blog_pub_check') == 0 ) )             return;              $post->post_category = wp_get_post_categories( $post_id );         $cats = array();         foreach( $post->post_category as $c ) {             $cat = get_category( $c );             $cats[] = array( 'name' => esc_html( $cat->name ), 'slug' => esc_html( $cat->slug ) );         }              $post->tags_input = implode( ', ', wp_get_post_tags( $post_id, array('fields' => 'names') ) );              $post->guid = $post_blog_id . '.' . $post_id;              $global_meta = array();         $global_meta['permalink'] = get_permalink( $post_id );         $global_meta['blogid'] = $org_blog_id = $wpdb->blogid; // org_blog_id              $meta_keys = apply_filters( 'sitewide_tags_meta_keys', get_sitewide_tags_option( 'tags_blog_postmeta', array() ) );         if( is_array( $meta_keys ) && !empty( $meta_keys ) ) {             foreach( $meta_keys as $key )                 $global_meta[$key] = get_post_meta( $post->ID, $key, true );         }         unset( $meta_keys );              if( get_sitewide_tags_option( 'tags_blog_thumbs' ) && ( $thumb_id = get_post_meta( $post->ID, '_thumbnail_id', true ) ) ) {             $thumb_size = apply_filters( 'sitewide_tags_thumb_size', 'thumbnail' );             $global_meta['thumbnail_html'] = wp_get_attachment_image( $thumb_id, $thumb_size );         }              // custom taxonomies          $taxonomies = apply_filters( 'sitewide_tags_custom_taxonomies', array() );         if( !empty( $taxonomies ) && $post->post_status == 'publish' ) {             $registered_tax = array_diff( get_taxonomies(), array( 'post_tag', 'category', 'link_category', 'nav_menu' ) );             $custom_tax = array_intersect( $taxonomies, $registered_tax );             $tax_input = array();             foreach( $custom_tax as $tax ) {                 $terms = wp_get_object_terms( $post_id, $tax, array( 'fields' => 'names' ) );                 if( empty( $terms ) )                     continue;                 if( is_taxonomy_hierarchical( $tax ) )                     $tax_input[$tax] = $terms;                 else                     $tax_input[$tax] = implode( ',', $terms );             }             if( !empty( $tax_input ) )                     $post->tax_input = $tax_input;         }              switch_to_blog( $tags_blog_id );         if( is_array( $cats ) && !empty( $cats ) && $post->post_status == 'publish' ) {             foreach( $cats as $t => $d ) {                 $term = get_term_by( 'slug', $d['slug'], 'category' );                 if( $term && $term->parent == 0 ) {                     $category_id[] = $term->term_id;                     continue;                 }                 /* Here is where we insert the category if necessary */                 wp_insert_category( array('cat_name' => $d['name'], 'category_description' => $d['name'], 'category_nicename' => $d['slug'], 'category_parent' => '') );                      /* Now get the category ID to be used for the post */                 $category_id[] = $wpdb->get_var( "SELECT term_id FROM " . $wpdb->get_blog_prefix( $tags_blog_id ) . "terms WHERE slug = '" . $d['slug'] . "'" );             }         }              $global_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->posts} WHERE guid IN (%s,%s)", $post->guid, esc_url( $post->guid ) ) );         if( $post->post_status != 'publish' && is_object( $global_post ) ) {             wp_delete_post( $global_post->ID );         } else {             if( $global_post->ID != '' ) {                 $post->ID = $global_post->ID; // editing an old post                      foreach( array_keys( $global_meta ) as $key )                     delete_post_meta( $global_post->ID, $key );             } else {                 unset( $post->ID ); // new post             }         }         if( $post->post_status == 'publish' ) {             $post->ping_status = 'closed';             $post->comment_status = 'closed';                  /* Use the category ID in the post */                 $post->post_category = $category_id;                  $p = wp_insert_post( $post );             foreach( $global_meta as $key => $value )                 if( $value )                     add_post_meta( $p, $key, $value );         }         restore_current_blog();     }     add_action('save_post', 'sitewide_tags_post', 10, 2);          function sitewide_tags_post_delete( $post_id ) {         /*          * what should we do if a post will be deleted and the tags blog feature is disabled?          * need an check if we have a post on the tags blog and if so - delete this          */         global $wpdb;         $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );         if( null === $tags_blog_id )             return;              if( $wpdb->blogid == $tags_blog_id )             return;              $post_blog_id = $wpdb->blogid;         switch_to_blog( $tags_blog_id );         $guid = "{$post_blog_id}.{$post_id}";         $global_post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid IN (%s,%s)", $guid, esc_url( $guid ) )  );         if( null !== $global_post_id )             wp_delete_post( $global_post_id );              restore_current_blog();     }     add_action( 'trash_post', 'sitewide_tags_post_delete' );     add_action( 'delete_post', 'sitewide_tags_post_delete' );          /**      * remove all posts from a given blog ($blog_id != 0)      * - used if a blog is deleted or marked as deactivat, spam, archive, mature      * - also runs if a blog is switched to a none public blog (called by      *   sitewide_tags_public_blog_update), more details on sitewide_tags_public_blog_update      * removes some posts if the limit is reached ($blog_id == 0)      * - triggered by other actions but without an given blog_id      * - number of posts to delete in $max_to_del      *       * @param $blog_id      */     function sitewide_tags_remove_posts($blog_id = 0) {         global $wpdb;         $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );         $max_to_del = 10;              if( !$tags_blog_id )             return;              /* actions on the tags blog */         if ( ($blog_id == 0) && ($wpdb->blogid == $tags_blog_id) )             return;              if ( $tags_blog_id == $blog_id )             return;              switch_to_blog( $tags_blog_id );              if ( $blog_id != 0 ) {             $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE guid LIKE '" . $blog_id . ".%' OR guid LIKE '" . esc_url( $blog_id ) . ".%'" );             if( is_array( $posts ) && !empty( $posts ) ) {                 foreach( $posts as $p_id ) {                     wp_delete_post( $p_id );                 }             }         } else {             /* delete all posts over the max limit */             if( mt_rand( 0, 10 ) ) {                 $allowed_post_types = apply_filters( 'sitewide_tags_allowed_post_types', array( 'post' => true ) );                 if( is_array( $allowed_post_types ) && !empty( $allowed_post_types ) ) {                     $post_types = array();                     foreach( $allowed_post_types as $k => $v ) {                         if( $v ) {                             $post_types[] = $k;                         }                     }                     if( is_array( $post_types ) && !empty( $post_types ) ) {                         if( count( $post_types ) > 1 )                              $where = "IN ('" . join( "','", $post_types ) . "') ";                         else                             $where = "= '" . $post_types[0] . "' ";                     } else {                         $where = "= 'post' ";                     }                     $posts = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_status='publish' AND post_type {$where} ORDER BY ID DESC limit " . get_sitewide_tags_option( 'tags_max_posts', 5000 ) . ", " . $max_to_del );                     if( is_array( $posts ) && !empty( $posts ) ) {                         foreach( $posts as $p ) {                             if( preg_match('|^.*\.([0-9]+)$|', $p->guid, $matches) && intval( $matches[1] ) > 0 )                                 wp_delete_post( $p->ID );                         }                     }                 }             }         }         restore_current_blog();     }     /* complete blog actions ($blog_id != 0) */     add_action('delete_blog', 'sitewide_tags_remove_posts', 10, 1);     add_action('archive_blog', 'sitewide_tags_remove_posts', 10, 1);     add_action('deactivate_blog', 'sitewide_tags_remove_posts', 10, 1);     add_action('make_spam_blog', 'sitewide_tags_remove_posts', 10, 1);     add_action('mature_blog', 'sitewide_tags_remove_posts', 10, 1);     /* single post actions ($blog_id == 0) */     add_action("transition_post_status", 'sitewide_tags_remove_posts');          /**      * called as an action if the public state for a blog is switched      * - if a blog becomes not public - all posts in the tags blog will be removed      * - bug on 1.5.1: update_option_blog_public is only triggered if the public state       *   is changed from the backend - from edit blog as siteadmin the action isn't      *   running and the state in the blogs backend isn't changed      *      * @param int $old - old public state      * @param int $new - new state, public == 1, not public == 0      */     function sitewide_tags_public_blog_update($old, $new) {         global $wpdb;         $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );              if( !$tags_blog_id )             return;              /* the tags blog */         if ( $tags_blog_id == $wpdb->blogid )             return;              if ($new == 0 ) {             sitewide_tags_remove_posts($wpdb->blogid);         }     }     add_action('update_option_blog_public', 'sitewide_tags_public_blog_update', 10, 2);          function sitewide_tags_post_link( $link, $post ) {         global $wpdb;         $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );         if( !$tags_blog_id )             return $link;              if( $wpdb->blogid == $tags_blog_id ) {             if( is_numeric( $post ) )                 $url = get_post_meta( $post, 'permalink', true );             else                 $url = get_post_meta( $post->ID, "permalink", true );                  if( $url )                 return $url;         }              return $link;     }     add_filter( 'post_link', 'sitewide_tags_post_link', 10, 2 );     add_filter( 'page_link', 'sitewide_tags_post_link', 10, 2 );          function sitewide_tags_pages_filter( $post_types ) {         if( get_sitewide_tags_option( 'tags_blog_pages' ) )             $post_types = array_merge( $post_types, array( 'page' => true ) );         return $post_types;     }     add_filter( 'sitewide_tags_allowed_post_types', 'sitewide_tags_pages_filter' );          function sitewide_tags_thumbnail_link( $html, $post_id ) {         global $wpdb;         $tags_blog_id = get_sitewide_tags_option( 'tags_blog_id' );         if( !$tags_blog_id )             return $html;              if( $wpdb->blogid == $tags_blog_id ) {             $thumb = get_post_meta( $post_id, 'thumbnail_html', true );             if( $thumb )                 return $thumb;         }         return $html;     }     add_filter('post_thumbnail_html', 'sitewide_tags_thumbnail_link', 10, 2);               function get_sitewide_tags_option( $key, $default = false ) {         static $tags_options = '1';         if( $tags_options == '1' ) {             $tags_options = get_site_option('sitewide_tags_blog');         }         if( is_array( $tags_options ) ) {             if( $key == 'all' )                 return $tags_options;             elseif( isset( $tags_options[$key] ) )                 return $tags_options[$key];         }         return get_site_option($key, $default);     }          function update_sitewide_tags_option( $key, $value = '', $flush = false ) {         static $tags_options = '1';         if( $tags_options == '1' ) {             // don't save unless something has changed             if( $key === true )                 return;             $tags_options = get_site_option('sitewide_tags_blog');         }         if( !$tags_options ) {             $tags_options = array();         }         if( $key !== true)             $tags_options[$key] = $value;         if( $flush || $key === true )             return update_site_option( 'sitewide_tags_blog', $tags_options );     }          ?>


title: Wordpress PHP Conflicting User Sessions

text: I'm using the following function to programmatically login users via the frontend:               function auto_login() {         $username = $_POST['user'];         if ( !is_user_logged_in() ) {             $user = get_userdatabylogin( $username );             $user_id = $user->ID;             wp_set_current_user( $user_id, $user_login );             wp_set_auth_cookie( $user_id );             do_action( 'wp_login', $user_login );         }          }     add_action('wp_ajax_auto_login', 'auto_login');     add_action('wp_ajax_nopriv_auto_login', 'auto_login');      However one weird issue I've run into is the following scenario:               1. User 1 logs in on PC 1          2. User 1 email is displayed as logged in in PC 1          3. User 2 logs in on PC 2          4. User 1 email is displayed as logged in in PC 2      I think this might be due to conflicting sessions but I'm not sure. I've looked up on this for quite a few days on Google yet nothing really came up which helped me. So my question is, how do I solve this issue of conflicting sessions? Thanks


title: Meta Data for Custom Post Type not saving

text: I'm in the process of building a custom plugin, and I'm having trouble saving meta data for the custom post type. The boxes display correctly in the editor, but when I click Publish or Save Draft, the values I've entered are not retained. I've pasted snippets of my code below. I've followed a few tutorials, and looked through several questions here, but it looks like I've followed everything correctly, and I can't figure out where I went wrong. I'm sure it's something obvious. Any help would be greatly appreciated. Custom Post Type               // Register the Jobs post type     function fg_registerJobsPostType() {         // Floodgate Jobs Post Type         $fg_postType = 'fg_job';              $jobsLabels = array(             'name'               => _x( 'Floodgate Jobs', 'post type general name', '' ),             'singular_name'      => _x( 'Floodgate Job', 'post type singular name', '' ),             'menu_name'          => _x( 'Floodgate Jobs', 'admin menu', '' ),             'name_admin_bar'     => _x( 'Floodgate Job', 'add new on admin bar', '' ),             'add_new'            => __( 'Add New', 'Floodgate Job', '' ),             'add_new_item'       => __( 'Add New Job', '' ),             'new_item'           => __( 'New Job', '' ),             'edit_item'          => __( 'Edit Job', '' ),             'view_item'          => __( 'View Job', '' ),             'all_items'          => __( 'All Jobs', '' ),             'search_items'       => __( 'Search Jobs', '' ),             'parent_item_colon'  => __( 'Parent Jobs:', '' ),             'not_found'          => __( 'No Jobs found.', '' ),             'not_found_in_trash' => __( 'No Jobs found in Trash.', '' ),         );              $jobsArgs = array(             'labels'             => $jobsLabels,             'public'             => true,             'publicly_queryable' => true,             'show_ui'            => true,             'show_in_menu'       => true,             'query_var'          => true,             'rewrite'            => array( 'slug' => 'fg_job' ),             'capability_type'    => 'post',             'has_archive'        => true,             'hierarchical'       => false,             'menu_position'      => 5,             'supports'           => array( 'editor', 'custom-fields' )                 );              register_post_type( 'fg_job', $jobsArgs );     }     add_action( 'init', 'fg_registerJobsPostType' );      And The Metaboxes               // Register the Jobs Metaboxes     function fg_registerJobsMetabox() {         /* Add meta boxes on the 'add_meta_boxes' hook. */         add_action( 'add_meta_boxes', 'fg_addJobMetaboxes' );              /* Save post meta on the 'save_post' hook. */         add_action( 'wp_insert_post_data', 'fg_saveJobsMeta', 10, 2);     }     add_action( 'load-post.php', 'fg_registerJobsMetabox' );     add_action( 'load-post-new.php', 'fg_registerJobsMetabox' );          // Build the display components for the Jobs Metaboxes     function fg_addJobMetaboxes() {         add_meta_box(             'fg_jobDesc',      // Unique ID             esc_html__( 'Job Description', 'Business Cards' ),    // Title             'fg_jobDescMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );              add_meta_box(             'fg_jobStatus',      // Unique ID             esc_html__( 'Job Status', 'Printing' ),    // Title             'fg_jobStatusMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );              add_meta_box(             'fg_jobDueDate',      // Unique ID             esc_html__( 'Due Date', '' ),    // Title             'fg_jobDueDateMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );              add_meta_box(             'fg_jobPriority',      // Unique ID             esc_html__( 'Job Priority', '' ),    // Title             'fg_jobPriorityMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );     }      And the save functions               function fg_verifyMetaNonce($metaKey) {         return  (isset($_POST[$metaKey . '_nonce']) && wp_verify_nonce( $_POST[$metaKey . '_nonce'], basename(__FILE__)));     }          function fg_saveMetaData($postID, $metaKey, $newMetaValue) {         /* Get the meta value of the custom field key. */         $metaValue = get_post_meta( $postID, $metaKey, true );              /* If a new meta value was added and there was no previous value, add it. */         if ( $newMetaValue && '' == $metaValue )             update_post_meta( $postID, $metaKey, $newMetaValue, true );              /* If the new meta value does not match the old value, update it. */         elseif ( $newMetaValue && $newMetaValue != $metaValue )             update_post_meta( $postID, $metaKey, $newMetaValue );              /* If there is no new meta value but an old value exists, delete it. */         elseif ( '' == $newMetaValue && $metaValue )             delete_post_meta( $postID, $metaKey, $metaValue );     }               // Save the Jobs Metadata     function fg_saveJobsMeta($postID, $post) {         /* Get the post type object. */         $postType = get_post_type_object( $post->postType );          /* Check if the current user has permission to edit the post. */     if ( !current_user_can( $postType->cap->edit_post, $postID ) )         return $postID;              // Save the Job Description         $metaKey = 'fg_jobDesc';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobDesc = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );              fg_saveMetaData($postID, $metaKey, $jobDesc);              // Save the Job Status         $metaKey = 'fg_jobStatus';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobStatus = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );                  fg_saveMetaData($postID, $metaKey, $jobStatus);              // Save the Job Description         $metaKey = 'fg_jobDueDate';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobDueDate = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );                  fg_saveMetaData($postID, $metaKey, $jobDueDate);              // Save the Job Description         $metaKey = 'fg_jobPriority';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobPriority = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );                  fg_saveMetaData($postID, $metaKey, $jobPriority);     }


title: loading javascript CDN with local fallback (not jQuery)

text: I'm trying to modify this to register and enqueue a jQuery plugin from a CDN with local fallback. However, when the URL fails (or if I give it a fake url) Firebug receives 2 aborted calls to the URL before loading the local fallback. With the jQuery fallback like the link, it only receives 1 aborted call. It looks like it is trying to load the script twice before using the fallback.               function gavsiu_scripts() {       if (is_single() && comments_open() && get_option('thread_comments') || is_page_template('page-contact.php')) {         wp_register_script('jquery_validate', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.min.js', array('jquery'), null, false);         add_filter('script_loader_src', 'gavsiu_jquery_validate_local_fallback', 10, 2);         wp_enqueue_script('jquery_validate');       }     }          add_action('wp_enqueue_scripts', 'gavsiu_scripts', 100);          function gavsiu_jquery_validate_local_fallback($src, $handle) {       static $add_fallback = false;            if ($add_fallback) {         echo '<script>if(typeof $().validate == \'undefined\') document.write(\'<script src="' . get_template_directory_uri() . '/js/jquery.validate.min.js"><\/script>\')</script>' . "\n";         $add_fallback = false;       }            if ($handle === 'jquery_validate') {         $add_fallback = true;       }            return $src;     }


title: Displaying terms based on loop posts?

text: I have a shortcode that shows a loop for a custom post type:               while ( $loop->have_posts() ) : $loop->the_post();          // do something     endwhile;      Some of the posts are in categories ($term->name), how do I display list of these categories and posts within them **based on that loop**? Example: I have 2 categories - "Foo" and "Bar", I have 5 posts in "Foo" and 5 posts in "Bar". I'm displaying all the posts and get something like this below them: > Foo (5) | Bar (5) But in different loop I'm using posts_per_page() limiter, and I'm displaying only 3 posts, not 10, so I want to get: > Foo (3) I was trying something like this:               while ( $loop->have_posts() ) : $loop->the_post();              $terms = get_the_terms($post->ID, 'portfolio_categories');               foreach ( $terms as $term ) {           $draught_links[] = $term->name;        }             var_dump($draught_links);              // do something     endwhile;      But doing foreach inside of while loop is messy and I'm getting something like > Foo (1) Foo (2) Foo (3) Foo (4) Foo (5) Foo (5) Bar (1) Foo (5) Bar (2) ... Any ideas?


title: How to extract images of post and pages excluding header and logo image in wordpress?

text: I have tried this code to get all images from media library and i am sucessfully getting the source urls of all the images but now i want to exclude all the unwanted images like logo, header images ,etc ... In short i want to extract all images attached to posts and pages ..               if(is_single() || is_page() || is_home() ){                 global $post;            $query_images_args = array(          'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1,'numberposts' => 1      );           $query_images = new WP_Query( $query_images_args );      $images = array();              foreach ( $query_images->posts as $image) {              $images[]= wp_get_attachment_url( $image->ID );                   }                 echo "<pre>";                  print_r($images);                  echo "</pre>";       My output Here the first image is a header image which is unwanted for me ..How to exclude it ..I have tried using attachment size but it cant be unique all the time .. Have a look at it               Array     (         [0] => http://localhost/wordpress/wp-content/uploads/2013/03/AboutUsSlider.jpg         [1] => http://localhost/wordpress/wp-content/uploads/2013/03/7325996116_9995f40082_n.jpg         [2] => http://localhost/wordpress/wp-content/uploads/2013/03/6310273151_31b2d7bebe.jpg         [3] => http://localhost/wordpress/wp-content/uploads/2013/03/4764924205_ce7470f15a.jpg         [4] => http://localhost/wordpress/wp-content/uploads/2013/03/2166105529_70dd50ef4b_n.jpg         [5] => http://localhost/wordpress/wp-content/uploads/2013/03/1494822863_aca097ada7.jpg         [6] => http://localhost/wordpress/wp-content/uploads/2013/03/1385429771_453bc19702.jpg     )


title: trying to write a variable into a wp_query, need help!

text: I am not a php coder, I am a designer and html and css guy. However, I am stuck at the moment trying to write a piece of code that will find the name of a post, then get and display all of the posts that have that name as their category. Something like this, Agent bio page has info about the agent and the bio post is his name and cat name. He has listings under his name which is also his category in the wp backend under categories. So under the bio info, I need to create a function that will display a list of all of his posts and display them with the thumbnail, some excerpt text and a couple of the custom fields I have created. this will be on a agent-single.php that will be used for every agent i have so it needs to find the post name with his slug in it and find posts based on that. Is there any way to actually do this or am I hoping for something that can not be done in wp?                 $template = basename(get_permalink());  // get agent here       $taskarr = array (         'post_type'   => 'listing',         'post_status' => 'publish',         'category' => $template,         'order'       => 'ASC',         'orderby'     => 'meta_value_num',         'metakey'     => 'listing_date', // this is a custom field         'metakey'     => 'location',       );       $tasks = get_posts($taskarr);       foreach( $tasks as $task ) {           //  Do stuff here, for example:           echo '<li>';           echo $task->post_title;           echo $task->the_excerpt;           echo $task->location;               echo '</li>';       }      this was inside my main loop which was a normal loop and of course it mutilates my code! ugh!!!


title: Determining a Widget Instance and Sidebar Location?

text: When using the filter:               add_filter('widget_display_callback', 'function_name');          function function_name($instance) {        /* Some Code */        return $instance;     }      Is it possible to determine the sidebar name and/or ID the particular widget instance is located within `function_name`?


title: Where is the WP auto-save draft JavaScript?

text: If you write a title, then move away from (blur) that input field, WordPress will auto-save a draft for you, likely in order to create a post slug placeholder for you. I'm looking to possibly extend this functionality to also save on blurring of the content body TinyMCE pane. The logic is not entirely straightforward -- for example, it appears to saves a draft only when the post is yet unpublished -- so I need to look further into the logic. In order to scope this change, I need to find where in the JavaScript (?) codebase WordPress does this auto-saving. Having trouble so far. Does anyone know?


title: WP 3.4 - what action/hook is called when theme customisation is saved?

text: i'm looking for the action/hook called when saving theme customs colors in the new admin interface? i need to call a custom function to save a set of php generated images. if anyone have clues... :) thanks


title: WordPress Template works until page becomes a child

text:
Ok so this is really strange. I do not consider myself a WordPress expert, but I am also not a beginner either. I created a template that works just the way I need it. Basically it checks for the attachments associated with the page and displays them in a gallery. This template works fine when there is no parent. When it becomes a child, however, it breaks. It reverts back to the static home page and the pages title becomes (space) - (site name), indicating to me that WordPress is confused as to what type of page it is. Here is the full template page:               <?php          /*          Template Name: Gallery          */          wp_register_script( 'script', get_template_directory_uri() . '/js/product-script.js' );     wp_register_script( 'jPages', get_template_directory_uri() . '/js/jPages.js' );     wp_enqueue_script( 'jPages');     wp_enqueue_script( 'script' );          get_header();           global $post;          $querystr = 'SELECT ' . $wpdb->prefix . 'posts.post_title AS "imageTitle", ' . $wpdb->prefix . 'posts.post_content AS "imageDescription", ' . $wpdb->prefix . 'posts.guid AS "imageGuid" FROM ' . $wpdb->prefix . 'posts WHERE ' . $wpdb->prefix . 'posts.post_parent = '. $post->ID .' AND ' . $wpdb->prefix . 'posts.post_type = "attachment" ORDER BY post_title  LIMIT 1';          global $wpdb;          $post_item = $wpdb->get_row($querystr);          $first_title = $post_item->imageTitle;     $first_attachment = $post_item->imageGuid;     $first_description = $post_item->imageDescription;               $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'title' );          $attachments = get_posts($args);          if ($attachments) {           ?>
          <?php echo the_title(); ?>
              <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

                          <?php                               foreach ( $attachments as $attachment ) {                              $title = apply_filters( 'the_title' , $attachment->post_title );                              $full_src = wp_get_attachment_image_src( $attachment->ID, 'full' );                              $thumb_src = wp_get_attachment_image_src( $attachment->ID, array( 100, 100) );                              $description = $attachment->post_content;                              $description = str_replace('*', '
', $description);                         $first_description = str_replace('*', '
', $first_description);                                   if ( get_post_meta($attachment->ID, 'new', true))                         {                             $new = 'New!';                         }                              $ul = '

';                         $end_ul = '

';                                   ?>
                                       <a class="thumb " href="<?php echo $full_src[0]; ?>" title="<?php echo $title; ?>" rel="<?php echo $full_src[0]; ?>" >                                      <img src="<?php echo $thumb_src[0]; ?>" alt="<?php echo $title; ?>" class="clearfix gallery-imgs"  />
                                 <?php echo $new; echo mb_strimwidth($title, 0, 14, '...'); ?>
<?php echo $description; ?>

<?php  echo $title; ?>

<?php echo $new; ?>

                              <?php                         unset($new);                          }                          ?>

                  <?php                  echo '
';                  echo '

'.$first_title.'

';                  echo '
';                  echo '';                  echo '
';                  echo '
';                  echo '
'.$first_description.'
';                  echo '

     <?php          endwhile; endif;          }     ?>
     <?php require ('modal-menu.php');?>
     <?php     get_footer();          ?>       Thinking that something in my code may be breaking it, I've already tried removing the initial query and the modal section at the end to no avail. Normally I'm searching for answers to this on my own...but in this case I have absolutely no idea where to even begin. Thanks for any help!


title: A Depth Like Parameter For "get_posts"

text: Wordpress has stumped me for the first time in a very long time. I am trying to limit the depth of a get_posts call in my template. I want to get children but limit it to a depth of only 3 as I am generating a faux menu. Is there a way perhaps through a subquery I can limit the depth without excluding pages or checking the page_parent value 3 times?


title: Change the search icon in twenty fourteen

text: I guess the title says all. I'm trying to change the search icon of the twenty fourteen theme, because I need a darker one. I tried like this:               .search-toggle {             background: url('http://www.citizen-science.at/wordpress/wp-content/themes/cs/img/search-icon.png');         }      which results in nothing.


title: Display widget outside sidebar?

text: I want to display a widget outside the sidebar, but I can't get my code to work. The theme name is `radius-primary-sidebar` and my widget id is `text-20` (according to the html in the admin page. See image #1). I've tried using `the_widget("radius-primary-sidebar", "widget-id=text-20")`, but that didn't return anything. What I'm I doing wrong? I'm using wordpress `3.5.2`. From `/wp-admin/widgets.php` in the admin panel. ![enter image description here](http://i.stack.imgur.com/6OMne.png)


title: Include Wordpress Page in TWIG Template File

text:
A programmer recently converted my Wordpress site to the TWIG engine and I am having a great deal of difficulty trying to include the contents of a page in the template. Below is my TWIG file for a calendar. The commented-out PHP is how I used to call up the page's content, which no longer work.

{{ section.title }}

Games

TCG

Anime

PokéBeach

                     {#                        <?php                     $id = 32242;                      $p = get_page($id);                      echo apply_filters('the_content', $p->post_content);*/                      ?>                     #}


title: Menu Multiple Taxonomies

text: I have a post_type "products" which has both "Category" and "Brand" taxonomies. Each product has exactly 1 Category, and exactly 1 Brand. I would like to display a menu which first lists the Categories as the top- level menu, and then lists the Brands contained in each as a Sub-Menu. Each Sub-Menu should only display the Brands which are associated with Products in that specific top-level Category. The links in the Sub-Menu should then go to a page that only shows Products in the selected Brand and Category... but I think I can figure this part out with wp_query. Mostly I am confused on the Menu issue. Any help is greatly appreciated!


title: Trying to create site-wide Active Directory sync with Multisite

text: we have a multisite server running, and we've got the Active Directory Integration plugin running. It works great individually, but each time I create a new site I have to manually activate plugin and do a bulk-import. Is there a way to set up Multisite to use Active Directory Integration (or any other sync method) site-wide instead of on each individual site? Thanks!


title: How to upload a media file via FTP and then create an attachment post with it?

text: I need to upload a very large video. I can not upload it via the built-in uploader since my upload_max_filesize is set to just 2M and I'm unable to override it (I've set the upload size to 50M and post size to 100M in .htaccess and php_info() does reflect my Changes) When I try to use the browser based upload tool I get this message: > The requested resource /wp-admin/media-new.php does not allow request data > with POST requests, or the amount of data provided in the request exceeds > the capacity limit. How do I upload a file manually via FTP and make it appear in the Media Library?


title: Using development versions of jQuery, TinyMCE, ...?

text: Is there a plugin or another easy way to get debug versions of the external Javascript libraries? ("External" because they were not written by the WordPress team, not because they come from Google or another CDN). If I define the `SCRIPT_DEBUG` constant to `true`, I get debug (non-minified) versions of most Javascript files in WordPress. However, some external libraries are still using the minified versions (check `wp_default_scripts()` for the scripts that don't have the `$suffix` part in their URL). I am creating a TinyMCE plugin and thus it would be handy to have the full TinyMCE source code when stepping up and down the call stack while debugging. (I know TinyMCE is loaded in an even more special way, but I'm also thinking of the jQuery library, which uses the standard `wp_register_script()` method.) I know that TinyMCE can be loaded as a compressed or a non-compressed Javascript, but both of these versions have been minified first, so that is not what I want. I want to load a non-minified version of TinyMCE, and possibly also the non-minified versions of the plugins.


title: how to limit and display tag?

text: Hi i need to show random 3 tags for a post. all my posts have been tagged with more than 10 tags, i need to display any 3 tags randomly. for eg: A sample post               Tag1     Tag2     Tag3      I am currently using `<?PHP the_tags()?>` to generate all tags how to restrict it to 3 randomly generated tags.


title: Wordpress Themes Directory: Template which hits the standards?

text: Is there a template which I can use for themes which I want to submit to the wordpress themes directory? A naked template which hits the standards of the Wordpress Themes Directory and which I could use as base for developping new themes would be great. Is there maybe an official "naked" theme which can be used for that?


title: How to correctly get post type in a the_title filter

text: I want to prepend text to the post titles of a specific custom post type, but the filter below didn't work. Instead of changing only that CPT's post titles, it changed _all_ titles on the given CPT's pages—menus items, posts in secondary loops, etc. What am I doing wrong? I'm guessing it's something to do with the scope of get_post_type().               add_filter( 'the_title', 'add_cpt_prefix' );          function add_cpt_prefix( $title ) {         if ( get_post_type() == 'press' ) {             $title = 'Press: ' . $title;         }         return $title;     }


title: Setting a custom $query->query_vars['meta_key'] breaks the WordPress menu

text: First of all, my problem is very similar to this one: http://stackoverflow.com/questions/10629245/wordpress-menu-disappears-when- query-query-varsmeta-key-is-set However, the answer accepted for this question does not help me for some reason. I am using the following code in my functions.php file to filter posts based on a custom field, which is set in the URL of a page:               function my_pre_get_posts( $query )     {         // validate         if( is_admin() )         {             return;         }              if( isset($_GET['county']) )             {                 $query->set('meta_key', 'venue_county');                 $query->set('meta_value', $_GET['county']);             }            }         return;          }     add_action('pre_get_posts', 'my_pre_get_posts');      I copied the code from this tutorial http://www.advancedcustomfields.com/resources/tutorials/creating-wp-archive- custom-field-filter/ The above code works, in that it filters the results on the venues archive page, if county has been set in the URL. However, this then breaks the wordpress main navigation menu. When I try and apply the fix to the code, by adding               if( ! $query->is_main_query()) return;      This fixes the menu but breaks the URL filtering, so all posts are returned not only those with a custom field of venue_county set to something. It's very frustrating, any help would be most appreciated! For example, is there a way of checking to see if the query is for the nav menu and not touching it if it is, but still allow modifying the second query of actually getting the posts on the page? I think this is what `if( ! $query->is_main_query()) return;` is supposed to do... Thanks


title: Run multiple domains under 1 wordpress instance

text: I have a question. I am trying to set up two domains under one wordpress instance. For instance, I have a wordpress site on www.site1.com I have another domain called www.site2.com. Now, I want to run the same wordpress site that is under www.site1.com on www.site2.com I tried using the wordpress domain mu mapping plugin http://wordpress.org/plugins/wordpress-mu-domain-mapping/installation/ But it only allows me subdomains or directories of www.site1.com Can anyone help?


title: How to do I get a list of active plugins on my wordpress blog programmatically?

text: I have 2 blogs, one which is multisite and one which isn't. I want to get a list of plugins active on both the blogs so I can compare them. On the multisite blog, I want to list the plugins which are enabled network-wide as well as site wide.


title: Can't publish posts, Jetpack won't connect, empty notification emails to my inbox

text: I own a self-hosted Wordpress blog and I am experiencing a lot of issues:   * Jetpack stopped working and it won't connect: `verify_secrets_missing : The Jetpack server encountered the following client error: Verification took too long`;   * can't post any entry, the _Publish_ button has been replaced with _Send for revision_ ;   * emails are sent to my inbox to notify a new comment, except there's no actual new comment and the email has empty fields;   * everytime I try to add a new user an empty email is sent to my inbox and the user isn't actually added. I am desperate to bring my blog back to normal, so far I have:   * deactivated all plugins and then re-activated;   * switched to the Twenty Eleven theme to rule out any theme-specific problems;   * reset the plugins folder by FTP;   * re-uploaded all files & folders (except the wp-content folder) from a fresh download of WordPress. Needless to say all this attempts have miserably failed. Then I've found out that my hosting had set the space for my DB to 5MB, now I have reset the space to 400MB, but still the issue remains. Any ideas about what can I try to get all back to normal?


title: Buddypress Plugin for register user from other site's

text: Buddypress plugin which register user from other social sites like...Facebook, twitter and also from google. I think there is one buddypress exist only for facebook but not for others.. any one know about.


title: Optimize CPT-function with a loop

text: I want to optimize my functions of a Custom Post Type (CPT). Now I have 10 meta boxes. For each box I have an extra function. The aim is to produce the 10 boxes in one function. I already tried the following code. The problem is that the entered values do not get saved.               function optimize() {          global $post;          $custom = get_post_custom($post->ID);          for ($i=0; $i<=9; $i++) {             $field_name[] = $custom['field_name'];             $checkbox_nr[] = $custom['checkbox_nr'];                  echo 'Field Name '.($i).' <input name="field_name' . $i . '" value="' .  $field_name[$i][0] . '" />';                  }               update_post_meta($post->ID, "field_name1", $_POST["field_name1"]);     }


title: Toggle Shortcode Sanitize Title

text:
Wondering if anyone can help me out... here is my custom theme shortcode:               add_shortcode('toggle', 'shortcode_toggle');     function shortcode_toggle( $atts, $content = null ) {     extract(shortcode_atts(array(         'title'      => '',         'class'      => '',     ), $atts));          $out .= '
' .$title. '
';     $out .= '
';     $out .= '
';     $out .= do_shortcode($content);     $out .= '
';     $out .= '
';      return $out; } This is located in my themes functions.php file. I want to be able to echo the title that is entered in for the toggle in the
      ... but I need it to strip out all characters and formatting (no spaces/symbols etc)... Any ideas? Thanks!


title: Tag URLs load a single post

text: I recently rebuilt a WordPress install (maintained database, replaced WordPress/plugins/theme files) after the site was compromised. It is working more or less correctly now, with the exception of tag links:               http://www.foo.com/tag/bar      forwards to a post tagged with `bar`, rather than displaying a list of posts tagged with `bar`. I've already replaced .htaccess with a newly generated one from options -> permalinks, to no avail. Google indicates a somewhat similar problem happening in conjunction with DB-Cache, which I do not have installed. Any ideas?


title: Will this js code work in a page template?

text: I have been given this code that I want to adapt and use to change a link in a `template.php` file, I have not been able to adapt it to work so would love any help that can be given.               <script type="text/javascript">     jQuery(document).ready(function($) {         if ( $(document).width() < 1500 ) {             $('.change-link > a').each( function(){                 newlink = 'Enter New URL';                 $(this).attr('href',newlink);             });         }     });     </script>      Will it work in a `template.php` and be able to choose between this link:               <?php include( TEMPLATEPATH . '/includes/projects.php'); ?>      and this link depending on the browser size?               <?php include( TEMPLATEPATH . '/includes/projects.php'); ?>      Or will it require more code in other pages of my WordPress theme?


title: Wordpress custom taxonomy page

text: I've got a question that I've seen being asked before, but none of the answers solved my problems. It's something I've run into before, but never managed to solve. I've got a clean Wordpress installation and in the `functions.php` file I've created a custom post type               register_nav_menu('main', 'Main navigation menu');          function add_custom_post_type() {         $labels = array(             'name' => _x('Books', 'post type general name'),             'singular_name' => _x('Book', 'post type singular name'),             'add_new' => _x('Add New', 'book'),             'add_new_item' => __('Add New Book'),             'edit_item' => __('Edit Book'),             'new_item' => __('New Book'),             'all_items' => __('All Books'),             'view_item' => __('View Book'),             'search_items' => __('Search Books'),             'not_found' =>  __('No books found'),             'not_found_in_trash' => __('No books found in Trash'),              'parent_item_colon' => '',             'menu_name' => __('Books')         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'show_in_menu' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'has_archive' => true,              'hierarchical' => false,             'menu_position' => null,             'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )         );               register_post_type('book', $args);     }      I've made an `archive-book.php` and `single-book.php` template files for those and everything works okay. I can view the books when I go to "http://localhost/wordpress/book" Now I want to create a custom taxonomy, so I did this in `functions.php` as well:               add_action('init', 'add_custom_post_type');          function add_custom_taxonomy() {         register_taxonomy(             'rating',             'book',             array(                 'label' => 'Rating',                 'hierarchical' => true,                 'show_ui' => true,                 'query_var' => 'book',                 'has_archive' => true,                 'rewrite' => array(                     'slug' => 'book/rating'                 )             )         );     }      And the taxonomy shows up in the admin page, I can add new terms, and add them to books. But now comes the problem. I've I want to go to an overview of all books with, let's say, rating "nice", I would go to "http://localhost/wordpress/book/rating/nice". I've created the following template files: taxonomy-rating-nice.php, taxonomy-rating.php and taxonomy.php. But somehow wordpress just shows the index.php file and doesn't list any books. I've tried flushing the rewrite rules with:               add_action('init', 'custom_taxonomy_flush_rewrite');     function custom_taxonomy_flush_rewrite() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }      And:               flush_rewrite_rules(false);      But nothings seems to help. So, anybody who can help me? If you need more information, please tell, cause I really want to fix this problem!


title: Show posts of parent in edit.php

text: I'm creating a post type for a site where there 4 main 'parent' pages in a custom post type. For the sake of argument the post type is 'schools' the 4 (of many) parents are: Cambridge Teesside Newcastle Sunderland The post type 'schools' is a hierarchical post type, and what I would like to do is treat any children of the top 4 pages as a blogroll in the individual pages. To do this I would like to add a custom menu item on the post type menu that looks something like this edit.php?post_type=schools&parent=123 Is this possible? If not, does anyone know of another way I can achieve this? Cheers


title: How to: Get the first image from the next and previous post in single.php? (5 posts)

text: I know I can call a function below but it works in loop at `index.php` only.               function catch_that_image() {        global $post, $posts;        $first_img = '';        ob_start();        ob_end_clean();        $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);        $first_img = $matches [1] [0];             if(empty($first_img)){ //Defines a default image           $first_img = "/images/default.jpg";        }             return $first_img;     }      However, I try to using this function in `single.php` or posting page. It was display only image at own ID only (can't display an image from next and previous posts). Can I make it display together in `single.php`?


title: WordPress Multisite Permalinks on mapped domain = server 404 error

text: I am setting up a multiblog. In sub-blogs that mapped on a different domain, permalinks work with only "default" values. They broke if set to other valid values. My main domain name is abc.com   I have three subdomains: aaa.abc.com, bbb.abc.com, ccc.abc.com   Everything works fine. Now, I need to map bbb.com to bbb.abc.com (for example). I've tried two methods: using the MU domain mapping plugin, and following the instructions there. In both cases, I get the exact same behavior:   * Everything seems to work.   * Domains are correctly setup and map correctly   * Links on blogs work if set to "default" (p=123)   * Permalinks on non-mapped sites (ccc.abc.com) work   * **on domains that are mapped (bbb.com) permalinks break if set to anything but default (yyyy/mm/post_name).** I've read countless threads, tried to modify my htaccess one thousand times, both trying the old markup, the new one, and several custom ones I found on different posts.   I've tried one million different custom permalinks (I'm pretty sure any kind permalink will not work). this is my configuration for this domain name (the relevant part at least):               <VirtualHost *:80>         ServerAdmin root@localhost         ServerName abc.com         ServerAlias *.abc.com         ServerAlias *.def.com         ServerAlias *.ccc.com         ServerAlias *.bbb.com         ServerAlias *.ghi.com                   DirectoryIndex index.html index.htm index.php         DocumentRoot /my_root/              RewriteCond %{HTTP_HOST} ^www.abc.com$ [NC]         RewriteRule ^(.*)$ http://abc.com/ [R=permanent,L]              <Directory /my_root>                 Options Indexes FollowSymLinks MultiViews                 AllowOverride All                 Order allow,deny                 Allow from all         </Directory>      What can I do?


title: Wordpress Load more posts by ajax not working

text:
i need to get the wordpress posts while click the load more button or something else, so i have followed the tutorial by Here               <?php     /*             Template Name: Additional Posts         */     $offset = htmlspecialchars(trim($_GET['offset']));         if ($offset == '') {             $offset = 5;         }              $args = 'post_type=event&posts_per_page=3&offset=$offset';                                $my_query = new WP_Query($args);                         if ( $my_query->have_posts() ) {                         while ($my_query->have_posts()) : $my_query->the_post();                           $event_id = get_post_meta( get_the_ID(), '_event_id', true );                     $location_id = get_post_meta( get_the_ID(), '_location_id', true );                     $custom_fields = get_post_custom(get_the_ID());                          global $wpdb;                     $em_states = $wpdb->get_results("SELECT *from  ".EM_LOCATIONS_TABLE." WHERE location_id = '$location_id' ");                     $em_ticket_price = $wpdb->get_results("SELECT *from  ".EM_TICKETS_TABLE." WHERE event_id = '$event_id' ");                     ?>

<?php echo get_the_post_thumbnail(get_the_ID(), array(269,168) ); ?>

<?php echo $em_states[0]->location_town;?> - <?php the_title(); ?>

<?php  $star_time = get_post_meta( get_the_ID(), '_start_ts', true );  echo date('g:i:s a ',$star_time);?>-<?php   $end_time = get_post_meta( get_the_ID(), '_end_ts', true );  echo date('g:i:s a ',$end_time); ?>

 <?php                                  $terms = get_the_terms(get_the_ID(), 'event-categories' );     if ($terms && ! is_wp_error($terms)) :         $term_slugs_arr = array();         foreach ($terms as $term) {             $term_slugs_arr[] = $term->name;         }         $terms_slug_str = join( " | ", $term_slugs_arr);     endif;     echo $terms_slug_str;?>

<?php echo $custom_fields['wpcf-from'][0]."-".$custom_fields['wpcf-to'][0]; ?>

Price Range

<?php echo $em_ticket_price[0]->ticket_price; ?>€

        <?php endwhile; } ?>                             and my jquery is follows                      it is working, but while click the get more link, am again getting the same posts as well as in the my original loop here in my page , i know that paged query is missing, or else what am missing ?


title: custom session variables being lost in FF

text: for whatever reason firefox is dropping my custom session variables. the variables are for a custom user system that is built into my custom theme. this only happens in firefox, the user system works perfect in all other browsers. heres the top of my header.php:               <?php          session_start();          global $errors, $success, $u_cache;          include 'sub-user-auth.php';          ?>      here is sub-user-auth.php:               <?php          $u_cache['logged_in'] = false;          if (!empty($_POST['u_signin']))     {         $errors = array();         $success = '';              foreach ($_POST as $k => $v)             $$k = trim(htmlspecialchars($v, ENT_QUOTES));              if (empty($u_username))              $errors[] = 'You must enter your username';         else if (empty($u_password))              $errors[] = 'You must enter your password';         else if (mysql_result(mysql_query("select count(*) from `users` where `username`='".mysql_real_escape_string($u_username)."' and `password`='".md5($u_password)."'"), 0) == 0)             $errors[] = 'Invalid username and/or password entered';              if (empty($errors))         {             foreach ($_POST as $k => $v)                 $$k = trim($v);                  $_SESSION['u_username'] = $u_username;             $_SESSION['u_password'] = md5($u_password);                  if ($u_remember == 'yes')             {                 setcookie('u_username', $u_username, time() + 31536000);                 setcookie('u_password', md5($u_password), time() + 31536000);                        }                  $success = 'You have been signed in successfully! Please click here to continue to your account.';                  foreach ($_POST as $k => $v)                 $$k = '';         }     }          if (!empty($_COOKIE['u_username']) && !empty($_COOKIE['u_password']))     {         $u_cache['u_username'] = $_COOKIE['u_username'];         $u_cache['u_password'] = $_COOKIE['u_password'];     }     else if (!empty($_SESSION['u_username']) && !empty($_SESSION['u_password']))     {         $u_cache['u_username'] = $_SESSION['u_username'];         $u_cache['u_password'] = $_SESSION['u_password'];     }          if (!empty($u_cache['u_username']) && !empty($u_cache['u_password']))     {         $sql = mysql_query("select * from `users` where `username`='".mysql_real_escape_string($u_cache['u_username'])."' and `password`='".mysql_real_escape_string($u_cache['u_password'])."'");              if (mysql_num_rows($sql) != 0)         {             while ($row = mysql_fetch_assoc($sql))             {                 foreach ($row as $k => $v)                     $u_cache[$k] = htmlspecialchars(stripslashes($v), ENT_QUOTES);             }                  $u_cache['logged_in'] = true;             $u_cache['fav_leagues'] = explode(',', $u_cache['fav_leagues']);             $u_cache['fav_teams'] = explode(',', $u_cache['fav_teams']);         }     }          if ($u_cache['logged_in'])     {         if (is_page(array('sign-in', 'sign-up', 'forgot-password')))         {             header('Location: '.get_bloginfo('url').'/my-home');             die();         }     }     else     {         if (is_page(array('my-home', 'edit-home', 'sign-out')))         {             header('Location: '.get_bloginfo('url').'/sign-in');             die();         }     }          ?>      what happens is it lets me log in, shows me the "my-home" page, then kicks me off almost immediately after and sends me back to the sign-in page. all of the custom session variables are dropped.


title: How to set thumbnail for each tag?

text: I would like to set thumbnails for each tag. I actually need two type of thumbnails. 16 x 16 and 90 x 90. 16 x 16 will be used infront of tag name like stackoverflow. 90 x 90 will be used in tag page as tag avatar. Is there any readymade plugin available? Can anyone help me? Thanks


title: How do you set up a WordPress blog with multiple authors to allow something like StackExchange's "community wiki" feature?

text: I'm thinking about having a blog with multiple authors. In the WordPress Roles documentation, authors can publish posts but only edit their own and not posts by other authors, which is what I'm looking for. I also want to allow certain posts to become open for anybody to edit without upgrading anybody to 'Editor', similar to the community wiki feature here on the StackExchange sites. Is this possible?


title: remove_filter( 'comment_author', 'floated_admin_avatar' ); doesn’t work

text: In a small plugin I’ve written to add an IP address column to the comments list I want to remove the avatars.   In line 156 I tried to use `remove_filter`:               remove_filter( 'comment_author', 'floated_admin_avatar', 50 );      Well … I know this function fails sometimes, but **why does it fail here?** My workaround is:               $_GET['comment_status'] == 'spam'          and add_filter( 'pre_option_show_avatars', '__return_zero' );      I guess I stared too long at this code to see what went wrong. I need a hint into the right direction.


title: Unable to upload new file as a product

text: I'm trying to upload an XML file (RSS feed) as part of a product in the WP- Ecommerce plug-in. The idea being that a customer buying the product would be given this XML file to download which ideally launch iTunes to download the balance as part of a podcast. I can't seem to upload the .XML feed file. I can upload other file types without a problem, but that one seems to be blocked. Where would I go to allow .XML files to be uploaded? Is it a WP-ECommerce thing, a WordPress thing, or perhaps something on the hosted server itself?


title: WP Customize refresh problem

text: Hi I am adding options to WP Customize. Mostly everything works, but One of my variable is not refreshed in the preview window.               $wp_customize->add_setting('checkbox', array(             'capability' => 'edit_theme_options',             'default' => false,         ));          $wp_customize->add_control('checkbox_control', array(         'settings' => 'checkbox',         'label'    => __('Activate Coming Soon Page', 'ln'),         'section'  => 'general_settings',         'type'     => 'checkbox',         'priority' => 1,     ));      This is how I add the checkbox and here is my check in functions.php               function template_redirect() {      if(true == get_theme_mod('checkbox')) {             include (TEMPLATEPATH . '/coming-soon.php');             exit;         }     }     add_action( 'template_redirect', 'template_redirect' );      So everything works. ~The only problem is that the preview window when you are in WP Customize and click the checkbox it reloads the page but it doesn't shows the change. If I click save and refresh manually then everything is fine. Any suggestion how to fix this issue? Thank you UPDATE: **I found what is breaking WP CUSTOMIZER, it is the exit of the redirect. Is there another way how to fix this issue. I need to redirect to that page if the checkbox is TRUE**                function template_redirect() {          if(true == get_theme_mod('checkbox')) {                 include (TEMPLATEPATH . '/coming-soon.php');                 exit;  !!!!!!!!!!!!!!!!!             }         }         add_action( 'template_redirect', 'template_redirect' );


title: TimThumb cache directory issue

text: I have a site with 9000 posts and those posts have external images and they are not stored on my server. These posts have thumbs that show on the homepage. My problem is this: whenever someone visits the site, many text files get created in the cache directory via `thumb.php` and they go up to 9000 if all my posts are featured. There are only text files in the cache directory, and they are not cleared any way automatically. How do I make them get cleared automatically? GoDaddy doesn't allow more than 1024 files to be stored in a single directory and therefore they issued a warning to me this morning. And I need to get those cache folders cleared automatically. I have `('FILE_CACHE_ENABLED', TRUE);` btw if this has anything to do with this issue. I didn't even touch `thumb.php`. My other sites work well and nothing is stored in their cache. I have also checked TimThumb's configuration page online. I've tried Timthumb Vulnerability Scanner, I have no caching plugin installed, I've also tried to create a cron job schedule, but on GoDaddy I could only manage to clear the directory at certain times, not for when a certain size is reached. GoDaddy allows up to 10 cron jobs and up to 5 minutes to function between cron jobs. During those 5 minutes, more than 1024 text files are created, which doesn't work for me. But I believe there must be something that can be done to clean the cache automatically? Thumbs are hosted elsewhere already. Cache only creates text files to identify, but doesn't clean them. Can anyone help me with this pretty please? Please explain what I need to do step by step as I have a very limited knowledge on this.


title: Admin - no Featured image choice in create new/page|post

text: I am developing a WP theme and I wanted to add a thumbnail/featured image to a new page/post but there is no such option/choice - like it used to be, I am using WP 3.8.1, I did try to turn off all the plugins - didnt help, I also checked the console for any errors - no error. Interesting is that with the native "Twentyfourteen" theme it works/shows. Any idea what might cause this behaviour? Is there anywhere anything what could turn this off?


title: Added new bulk action, but only work on bottom dropdown

text: I've added Archived bulk Action to my CPT, but my problem is that everything work fine only if we select the action in the second dropdown. That's how i've added the new Bulk Action               add_action('admin_head', 'add_bulk_action');     function add_bulk_action() {         global $wp_list_table;         $current_screen = get_current_screen();              if($current_screen->id == 'edit-programmation') {                 $wp_list_table->_actions = array_merge(                 $wp_list_table->get_bulk_actions(),                 array( 'archive' => __( 'Archiver' ) )             );         }     }      And my custom bulk action verification               add_action('load-edit.php', 'custom_bulk_action');     function custom_bulk_action() {     global $typenow;     $post_type = $typenow;          if($post_type == 'programmation') {              // get the action         $wp_list_table = _get_list_table('WP_Posts_List_Table');  // depending on your resource type this could be WP_Users_List_Table, WP_Comments_List_Table, etc         $action = $wp_list_table->current_action();              /* $action return -1 if I don't choose my action from the bottom dropdown... */              $allowed_actions = array("archive");         if(!in_array($action, $allowed_actions)) return;                   // security check         check_admin_referer('bulk-posts');              // make sure ids are submitted.  depending on the resource type, this may be 'media' or 'ids'         if(isset($_REQUEST['post'])) {             $post_ids = array_map('intval', $_REQUEST['post']);         }              if(empty($post_ids)) return;              // this is based on wp-admin/edit.php         $sendback = remove_query_arg( array('archived', 'untrashed', 'deleted', 'ids'), wp_get_referer() );         if ( ! $sendback )             $sendback = admin_url( "edit.php?post_type=$post_type" );              $pagenum = $wp_list_table->get_pagenum();         $sendback = add_query_arg( 'paged', $pagenum, $sendback );              switch($action) {             case 'archive':                      $archived = 0;                 foreach( $post_ids as $post_id ) {                          if ( !perform_archiving($post_id) )                         wp_die( __('Error while archiving spectacle.') );                          $archived++;                 }                 $sendback = add_query_arg( array('archived' => $archived, 'ids' => join(',', $post_ids) ), $sendback );                 break;                  default: return;         }              $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );              wp_redirect($sendback);         exit();     }     }      Thank's for your help.


title: WordPress - "tag page" additional, custom content

text: Please look at it here TAG page morsblog [dot] dk/tag/stranden/ For THIS TAG, I want to write some text in WordPress (it should have possibility to add defined text to any defined tag). It should look something like this: http://farblog.dk/tag/motorsav-bukser/ Is it possible to make a little plugin that make the text be shown, and providing an opportunity to display the Adsense code below? Thanks!


title: How do I park secure.primary.com on top of the multisite ID:1 domain: www.primary.com (primary multisite domain)

text: We have a multisite setup, the primary domain needs to have www.primary.net, and secure.primary.net mapped in wordpress so the primary site's content loads on both. The problem we are facing is secure.primary.com doesn't work. secure.primary.net always ends up at: http://www.primary.net/wp- signup.php?new=secure.primary.net The headers returned from the server are as follows: Status: HTTP/1.1 302 Moved Temporarily Date: Tue, 16 Oct 2012 19:55:53 GMT Server: Apache Location: http://www.primary.net/wp- signup.php?new=secure.primary.net Content-Length: 0 Connection: close Content- Type: text/html; charset=utf-8 Basically I just need this to work, even if it means ripping into the core Wordpress files and making changes. I've tried various domain mapping plugins and such and nothing works correctly. One of the problems is that they don't allow mapping on the primary network domain. Any suggestions on what I can edit in WordPress or a starting point would be great. Thanks.


title: Only one category per post

text: How to make each post/page have one and only one category. Categories could have radio box instead of checkbox next to each.


title: How to disable a network enabled plugin for just one site?

text: I'm in the process of setting up a (potentially) large multisite network, and I'm looking to make it as easy as possible now to add and configure sites when needed. I'm currently at the phase where I'm dealing with plugins. With multisite I am aware of several different ways you can activate plugins   * Put the plugin in `/plugins`, activate it on every site invidually   * Put the plugin in `/plugins`, use 'network activate' to activate it on **all** sites   * Put the plugin in `/mu-plugins`, automatically activated on every site Now, I've been playing with the settings and I want to activate Akismet on all sites **but** one or two. I thought I would be able to network activate the plugin and then disable it on a single site, but I am unable to do so - if I use network activate then there is only the option to 'network deactivate' - which deactivates the plugin across all sites. Is there a way to have the handy functionality of network activate but yet still have the convenience of being able to deactivate plugins on a site-by- site basis?


title: Is the part "category" fixed to an URL to an archive or post?

text: I'm asked to set up a WordPress-based site, which is not intended to run as blog mainly but anyway we want to use the common article area sometimes. Now my client resents that the URL to an article or archive includes "/category/". He wants to make use of tags but categories are redundant since he only wants to have an area called "news" which holds all stuff written as common articles. So my question is: Can I set my theme to simply make URLs like this: "example.com/news/an-article-about-something"?


title: Which plugin can do horizontal scrolling of RSS feeds in WordPress

text: I need a plugin which can do horizontal scrolling of RSS feeds in wordpress, I have got a vertical scrolling RSS feeds but cannot find a horizontal one


title: How to create custom message on plugin update

text: I saw this message today when accessing my plugin page: ![custom plugin update message](http://i.stack.imgur.com/v1SP2.png) So, how do I create this if I want to update my own plugins that's hosted on wordpress?


title: I need a plugin in wordpress like google tasks

text: I need a plugin like google tasks, in which we can add in to do tasks on the wordpress page


title: How to get last_updated and newest_blogs in WP 3.0

text: We were using WPMU version 2.9.1, in which we had a plugin - Fimii WPMU Stats mu-plugin - that showed us last updated blogs, and newest blogs.   We now upgraded to Wodpress 3.0, and the commands for the plugin don't work anymore. Does anyone know of a replacement for that plugin? Or something else that will show the data?


title: Limit author image size

text: Is there a way to limit the size (dimensions) of the image a user can upload to their profile? It looks like Wordpress does do some kind of limiting as uploading a 1024x768 image the result gets scaled down to 360x270, but where is that configured, either in the UI (which I haven't found) or through code? This is the section of the user profile I'm referring to: ![alt text](http://i.stack.imgur.com/dIZiy.png)