title: WordPress is replacing double minus signs in Post Title, how to disable it?

text: sometimes i have Post Titles that contains 2 minus signs side by side (--) but wordpress is always removing one of the minus sign. Looks like: `My--Text` into `My-Text` any idea how to disable it? Best regards, Chris


title: Retrieve all term IDs of post

text: I have an array of term IDs that I'd like to filter my query with, but most wordpress functions seem to need the 'taxonomy' field entered too. Is there a reason for this? Passing the taxonomy ID seems to be unnecessary, if all term IDs are unique anyway, unless I'm missing something. As it seems as though I can't query this with Wordpress direct, I'd be looking for something like:               $terms_array = get_term_ids( get_the_ID() );      Any ideas of the best way to pull this off?


title: User activation in wordpress

text: I want my users to first to activate their accounts so they can use all the features in the site.   There is a field in `wp_users` table named `user_status` which its default value is `0`.   I wonder what's that field for?   Should I use a `user_meta` to indicate the activation status of my users. P.S. The registration of users is handled manually through a plugin I'm writing.


title: How to extract all ID variables from a query string?

text: What is the best php method to extract all IDs from a query string and display them in a comma separated list? I have a function that grabs specific posts from the database and am trying to enter those ID's into a new wp_query loop.               Array (         [0] => stdClass Object (             [ID] => 162             [post_author] => 1             [post_date] => 2011-10-22 09:25:46             [post_date_gmt] => 2011-10-22 14:25:46             [post_content] =>             [post_title] => Paper III             [post_excerpt] =>             [post_status] => publish             [comment_status] => open             [ping_status] => open             [post_password] =>             [post_name] => paper-iii             [to_ping] =>             [pinged] =>             [post_modified] => 2011-12-22 09:22:05             [post_modified_gmt] => 2011-12-22 14:22:05             [post_content_filtered] =>             [post_parent] => 0             [guid] => http:/mysite.org/?post_type=album&p=162             [menu_order] => 0             [post_type] => album             [post_mime_type] =>             [comment_count] => 0             [user_nicename] => matt         )         [1] => stdClass Object (             [ID] => 166             [post_author] => 2             [post_date] => 2011-12-22 11:32:46             [post_date_gmt] => 2011-12-22 16:32:46             [post_content] =>             [post_title] => mtayla's album             [post_excerpt] =>             [post_status] => publish             [comment_status] => open             [ping_status] => closed             [post_password] =>             [post_name] => mtaylas-album             [to_ping] =>             [pinged] =>             [post_modified] => 2011-12-26 20:23:00             [post_modified_gmt] => 2011-12-27 01:23:00             [post_content_filtered] =>             [post_parent] => 0             [guid] => http:/mysite.org/?post_type=album&p=166             [menu_order] => 0             [post_type] => album             [post_mime_type] =>             [comment_count] => 0             [user_nicename] => mtayla         )         [2] => stdClass Object (             [ID] => 308             [post_author] => 2             [post_date] => 2012-01-31 15:04:29             [post_date_gmt] => 2012-01-31 20:04:29             [post_content] =>             [post_title] => another album             [post_excerpt] =>             [post_status] => publish             [comment_status] => open             [ping_status] => open             [post_password] =>             [post_name] => another-album             [to_ping] =>             [pinged] =>             [post_modified] => 2012-01-31 15:04:29             [post_modified_gmt] => 2012-01-31 20:04:29             [post_content_filtered] =>             [post_parent] => 0             [guid] => http:/mysite.org/?post_type=album&p=308             [menu_order] => 0             [post_type] => album             [post_mime_type] =>             [comment_count] => 0             [user_nicename] => mtayla          )     )


title: Optimal approach for replacing the 8 header images in a child theme?

text: After creating a child theme which is made of `style.css` only (base on `twentyeleven`), the time has come to replace the images. I found this great tip for accomplishing this by hacking the functions in `twentyeleven` but my main concern is minimizing work after a WordPress update. I thought of simply replacing the images in `/wp- content/themes/twentyeleven/images/headers` (while keeping the original names as came with `twentyeleven`) but is this better? It looks like either way I will have re-apply my customizations after updating WordPress in the future. Is there a way to replace the 8 images, _for a child theme_ , and still maintain the changes after an update?


title: Need post_type_archive_title function but in 'single'

text: I'm trying to pull a custom post type name/title out for use in the breadcrumb of a single-[cpt].php template file. In the archive-[cpt].php I can use post_type_archive_title() and it echo the name. How would I get this same title in a single view? Thanks! I've trawled though the codex and haven't seen a function, but might have missed it!


title: Setting Custom Email From name and email address in wp_email()

text: I am writing a custom plugin that sends an email to users from admin/front end section. I am using wp_email() to send emails and emails are being sent fine. I am testing this on a plain WP installation with only my plugin installed and hostgator as my hosting server. Whenever the email is sent, the email is sent from xyz@gator39.hostgator.com and not from the email address of WP admin account. I have also tried setting custom hooks as mentioned here and setting custom headers, but none of them is working. I am not sure what mistake I am doing. Can you please guide me on solving this issue. Code provided below **EDIT** I have also tried testing it from another dedicated windows server and getting same error.               // new name     function smartsms_mail_from_name() {         return "WebMaster";         //$name =  get_option('blogname');         //$name = esc_attr($name);         //return $name;     }          // new email-adress     function smartsms_mail_from() {         return "webmaster@example.com";         //$email = get_option('admin_email');         //$email = is_email($email);         //return $email;     }     add_filter( 'wp_mail_from', 'smartsms_mail_from' );      add_filter( 'wp_mail_from_name', 'smartsms_mail_from_name' );          //$headers = 'From: '. get_option('blogname') .' <' . get_option('admin_email') . '>';                 $headers = 'From: webmaster@example.com' . "\r\n" .'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();                  $mail = wp_mail($to, $subject, $message, $headers);      > After Brady's answer below, edited the code as below..but no email was sent. > However, I get the message as "Message was sent successfully" :(               if($to!="")             {                 //$headers = 'From: '. get_option('blogname') .' <' . get_option('admin_email') . '>';                 //$headers = 'From: webmaster@example.com' . "rn" .'Reply-To: webmaster@example.com' . "rn" . 'X-Mailer: PHP/' . phpversion();                  add_filter('wp_mail_from', 'smartsms_mail_from'); // add filter to modify the mail from                 add_filter('wp_mail_from_name', 'smartsms_mail_from_name'); // add filter to modify the mail from name                 add_filter('wp_mail_content_type', 'smartsms_wp_mail_content_type'); // add filter to modify the mail content type                 $mail = wp_mail($to, $subject, $message); // send mail                 remove_filter('wp_mail_from', 'smartsms_mail_from'); // remove applied filter                 remove_filter('wp_mail_from_name', 'smartsms_mail_from_name'); // remove applied filter                 remove_filter('wp_mail_content_type', 'smartsms_wp_mail_content_type'); // remove applied filter                 //$mail = wp_mail($to, $subject, $message, $headers);                            if($mail)                 {                     echo 'Your message has been sent!';                              }                 else echo 'There was a problem sending your message. Please try again.';             }          // new name     function smartsms_mail_from_name() {         return "WebMaster";         //$name =  get_option('blogname');         //$name = esc_attr($name);         //return $name;     }          // new email-adress     function smartsms_mail_from() {         return "webmaster@example.com";         //$email = get_option('admin_email');         //$email = is_email($email);         //return $email;     }          function smartsms_wp_mail_content_type() { return "text/html"; }


title: Parent Child Custom Fields with Advanced Custom Fields

text: i have a navigation menu for Year, Make, Model of cars. Is it possible to Parent, Child custom fields so that if I have selected 2011, Honda, CRV I don't want other Models from non hondas being shown after I have Honda selected http://ansamaverick.com/inventory/


title: Why would get_posts be ignoring posts with 2-digit ids?

text: I'm using this code to list child pages of the current page and similar code to get child pages of all ancestors to use in a sidebar contextual hierarchical nav menu:               $pageset = get_posts('numberposts=0&post_type=page&post_parent='.$wp_query->post->ID);      For some reason, both iterations are ignoring posts with a two-digit post id. Everything else shows up fine. Am I missing something? Do I have a setting that's incorrect? I'm banging my head here...


title: I want to edit an AJAX Wordpress Pagination

text:
I am using this code to be able to load my content using Ajax (loading content without refreshing the page). The code I found fades out the content and fades in the new content. I want to add the new content under the old ones. In other words, similar to Wordpress's Twenty Thirteen Theme. Can someone help me This is the script after the `wp_header();` in header.php                     This is how my html code looks like
          <?php $my_query = new WP_Query( $args );             if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>


title: Wordpress Twenty Eleven PhP - forcing php code to skip first post on homepage?

text:
![What I want to fix](http://i.stack.imgur.com/TjZDM.png) I have set up my Wordpress to add the wordpress Featured Image thumbnails to all posts on the homepage. How do I make the code skip adding [wordpress Featured Image thumbnails][3] to the first post [the_content() ~ in the code below] and only add them to [wordpress Featured Image thumbnails][4] the other posts [the_excerpt() ~ in the code below]? Code I put in content.php to make it put [wordpress Featured Image thumbnails][5] on homepage. Link to pastebin code Here                   <?php if ( is_search() | is_home() ) : // Edit this to show excerpts in other areas of the theme?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">         <?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?>
                           <?php  if($wp_query->current_post == 0 && !is_paged()) { the_content(); } else { the_excerpt(); }     ?>
                 <?php else : ?>
                         <?php the_content( __( 'Continue reading →', 'twentyeleven' ) ); ?>                         <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyeleven' ) . '', 'after' => '
' ) ); ?>
                 <?php endif; ?>


title: In a MS install, can you allow different users to have their own themes?

text: Is it possible in a MS install to allow network site admins to edit their own themes? For example, I would like to give everyone access to theme ABC, but if one user edits that theme, they seamlessly create their own instance of the theme, so no other user's theme is affected. I believe the short answer is "no" so I'm wondering if there are any good ideas about how to implement this kind of system.


title: woocommerce_payment_complete hook only called after accepting payment?

text: Is there a particular paypal setting that allows WooCommerce to execute `woocommerce_payment_complete` without manually accepting the payment? I have a function that hooks on it. It basically updates a record in the database once the client has finished purchasing the product. Thoughts?


title: Correct Approach for Validating Custom Field Input

text: I have a custom post type with several custom fields. I am looking to do some validation on these fields because they will be used downstream by other services. So, it is important that it can't be saved until it is correctly entered. The validation is reasonably complex and requires custom logic. Unfortunately, it also won't work to use a plugin in this particular case. Is there an ideal hook to use in this case? At a high level -- whats the best way to go about this.


title: Add-action in function

text: How can i get add_action to work in a function, I want to hide a few admin menu item but not make the user and editor.               function my_remove_menu_pages() {         remove_menu_page('tools.php');         remove_menu_page('themes.php');         remove_menu_page('options-general.php');         remove_menu_page('plugins.php');     }          add_action('admin_init', 'check_username');     function check_username()     {         $user = wp_get_current_user();              if($user && isset($user->user_email) && 'username@example.com' == $user->user_email)         {             add_action( 'admin_menu', 'my_remove_menu_pages' );         }     }


title: Register Taxonomy earlier so it can be used in functions.php and admin-ajax.php

text:
This is a follow up to this post, outlining why I can not use the get_terms function while in functions.php (actually calling via ajax/admin_ajax.php). I can grab the terms (custom tax) on any post, on any page, except when in my ajax function. I receive the dreaded 'taxonomy does not exist' error when dumping the value of get_terms. The problem is, the taxonomy is registered _after_ I call the function to find the terms. The question is, how do I register the tax early enough so I can use this function? My code to register the custom post type and taxonomy is first in my functions.php (included via an external php to keep functions.php clean)               /************************************************      *     * 1.0 ------------------ Events ----------------     *     ************************************************/               // 1. Custom Post Type Registration (Events)     add_action( 'init', 'create_event_postype', 0 );          function create_event_postype() {       $labels = array(         'name' => _x('Events', 'post type general name'),         'singular_name' => _x('Event', 'post type singular name'),         'add_new' => _x('Add New', 'events'),         'add_new_item' => __('Add New Event'),         'edit_item' => __('Edit Event'),         'new_item' => __('New Event'),         'view_item' => __('View Event'),         'search_items' => __('Search Events'),         'not_found' =>  __('No events found'),         'not_found_in_trash' => __('No events found in Trash'),         'parent_item_colon' => '',     );          $args = array(         'label' => __('Events'),         'labels' => $labels,         'public' => true,         'can_export' => true,         'show_ui' => true,         '_builtin' => false,         '_edit_link' => 'post.php?post=%d', // ?         'capability_type' => 'post',         'menu_icon' => get_bloginfo('template_url').'/images/icons/events.png',         'hierarchical' => false,         'rewrite' => array( "slug" => "events" ),         'supports'=> array('title', 'thumbnail', 'excerpt', 'editor', 'custom-fields') ,         'show_in_nav_menus' => true,         'taxonomies' => array('post_tag', 'tf_eventtype')     );          register_post_type( 'tf_events', $args);          }          // 2. Custom Taxonomy Registration (Event Types)     add_action( 'init', 'create_eventtype_taxonomy', 0 );     function create_eventtype_taxonomy() {            $labels = array(         'name' => _x( 'Event Type', 'taxonomy general name' ),         'singular_name' => _x( 'Event Type', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Event Types' ),         'popular_items' => __( 'Popular Event Types' ),         'all_items' => __( 'All Event Types' ),         'parent_item' => null,         'parent_item_colon' => null,         'edit_item' => __( 'Edit Event Type' ),         'update_item' => __( 'Update Event Type' ),         'add_new_item' => __( 'Add New Event Type' ),         'new_item_name' => __( 'New Event Type Name' ),         'separate_items_with_commas' => __( 'Separate event types with commas' ),         'add_or_remove_items' => __( 'Add or remove event types' ),         'choose_from_most_used' => __( 'Choose from the most used event types' ),     );          register_taxonomy('tf_eventtype','tf_events', array(         'label' => __('Event Type'),         'labels' => $labels,         'hierarchical' => true,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'event-type' ),     ));     }      Here is some pseudo code to show how I'm calling this function from a custom page, I call a function via AJAX (ajax-admin.php)               $.ajax({                   type: "POST",                   url: "<? bloginfo('url'); ?>/wp-admin/admin-ajax.php", //Built in WP AJAX                 data: data,                  success:  function(data){                              //console.log('search complete');                              $("#event-list").html(data)                                                                                }           });      Here is the function that calls a custom query, and where get_terms fails.               /****************************************************************     *     * 1.0 Calendar AJAX Queries     *     ****************************************************************/     // if both logged in and not logged in users can send this AJAX request,     // add both of these actions, otherwise add only the appropriate one     add_action( 'wp_ajax_nopriv_calendar_search', 'calendar_search' );     add_action( 'wp_ajax_calendar_search', 'calendar_search' );          function calendar_search() {                     $args = array(                 'post_type' => 'tf_events',                          'post_status' => 'publish',                 'order' => 'ASC'             );                  $query = new WP_Query( $args );                   // - loop start -             if ( $query->have_posts() ) {                   while ($query->have_posts()) : $query->the_post(); /*Shows the posts that are available. */                          //Event Type                     $cats = get_the_terms($post->ID , 'tf_eventtype'); //the function that fails. All other custom data works fine                           echo                      '
ID . '"  itemscope itemtype="http://schema.org/Event">                                               <time></time>
'. get_the_title() . '

';                            if($cats) foreach($cats as $cat){                                  echo " | " . $cat->name;                            }                            echo                           "

";                      endwhile;               } else {                 echo "
Sorry, no events found!
";                           }              die(); // this is required to return a proper result            }


title: Where to post/upload the new theme for WordPress theme repository

text: After a long dedication, I developed a GPL Theme for WordPress. I want it to be available for FREE to WordPress.org Theme Repository. But consulting many Codex resources, I found no direct link where I can post/upload my theme for the WP Theme Repository. **Q: Where can I upload my theme for WP Theme Repository?**


title: Get Latest Plugin Version from WP API

text: I'm writing a plugin that checks and collects data from WP - including info about installed plugins. I can get most of the data I require using `get_plugins()` - however, I'd also like to check for the latest repository hosted version of each plugin - but I can't seem to find an API method for this. Sorry, I've got no code to paste for commenting.. but I've had a good search around - honest! Where I can find a simple and efficient way to check?


title: How to remove the suffix from tag title of the current archive

text: Hi I am new to WordPress. I am developing a website. I am listing the name of all categories as my menu bar. The problem is that when I click on a category from the menu bar, the word 'Archive' is displayed along with the name of the category. It is displaying the same with all categories in the menu bar. How can I remove the word 'Archive' from the title from being displayed? Please help me.


title: Add content to /wp-admin/plugin-install.php admin screens

text: I would like to add some external content to the plugin information displayed on the `/wp-admin/plugin-install.php` admin screens. `/wp-admin/plugin-install.php` calls the following:               $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');      And if I hack this core file as a test, I can add the content, I want, OK. However as a new WP developer I am really struggling to see how I can add this content via a plugin. `class WP_Plugin_Install_List_Table` extends `WP_List_Table` so I don't think I can extend this any further. Is there a way to add content via a plugin to these screens?


title: Multisite behind Varnish

text: I'm trying to use varnish with a wp 3.0.5 site with Network (Multisite), when I access the varnish URL, I get this message:               Multisite only works without the port number in the URL.      Do I need a custom VCL to make this work? I'm using the same backend config for other wordpress sites that work fine.. If I need to ask this on serverfault, let me know and I'll ask there.


title: wp_insert_user email confirmation

text: I'm creating a new user once they leave a comment, i am doing this with wp_insert_user function create_comment_user($comment_ID){ global $wpdb;               $comment = get_comment($comment_ID, ARRAY_A);     if($comment["user_id"] == 0){         $user = get_user_by('email', $comment["comment_author_email"]);         if(! $user){             $new_id = wp_insert_user(array(                     'user_pass' => wp_generate_password(),                     'user_login' => $comment["comment_author_email"],                     'user_email' => $comment["comment_author_email"],                     'user_nicename' => strtolower(str_replace(' ', '-', $_POST['author'])).'-'.strtolower(str_replace(' ', '-', $_POST['author_last'])),                     'display_name' => ($_POST['author']).' '.($_POST['author_last']),                     'first_name' => ($_POST['author']),                     'last_name' => ($_POST['author_last']),                     'role'      => 'Subscriber'                 )             );             if($new_id)                 wp_new_user_notification( $new_id );         }     }     return;     }     add_action("comment_post", "create_comment_user", 10, 1);      The email confirmation does not get sent, but the user is being created. Any ideas why?


title: I changed my site from HTTPS back to HTTP and now it is broken- Cannot access Admin panel on HTTP URL

text: I have a WordPress site that I was running every page over SSL for the past year. I just added a new website to the same server and have to share IP with the new site and the new site needs SSL much more then the old site. So I have gone through the process of changing all my `https` links back to `http`. My site loads fine now over regular `http` except I have 2 issues. 1) When I view source, it is showing a lot of stuff still linked to `https` however none of it is from the Database. IT is instead all places where `home_url()` is used to generate the URL! I have done a search and replace of the whole entire database to ensure all https links are back to http however it is acting as if my sites URL is still HTTPS when I call the WordPress settings for the URL. 2) Because of this bizarre behavior I cannot access my Admin panel as it redirects to `https` now! Like I mentioned the database does not contain HTTPS anywhere anymore. I have no plugins that force Admin or anything to use HTTPS either. So I cannot for the life of me understand why `home_url()` prints out an `https` URL instead of `http` when the DB has all `http` url's. Also note these details...   * that I do not have any caching!   * I have deleted all Transients as well   * There is nothing in the htaccess file that is making my admin panel redirect to https yet it does redirect to https which no longer exxist so I cannot login to admin panel anymore.   * All database files have been updated and converted from `https` to `http` in every wordpress related table. posts, options, etc...   * There is no plugin that I can see that would be doing this so far   * I also do not see any code in my functions or any other included custom file that would be changing my `home_url()` function into `https`   * There is nothing in my `wp-config.php` file causing this.


title: image class removed in excerpt

text: I have inline images in my post content that have classes. the classes are available as I go to single page like this:                      , but are removed as I look them at my homepage by using excerpt.                     does wordpress manipulate the classes, in excerpt?


title: how to deactivate a plugin without using a WP function?

text: I wish to deactivate my plugin, but WITHOUT using update_option() or any other core WP function. What's the best way to go about this? Direct DB connection and modification?


title: Is there any Reference of Wordpress hook and hacks?

text: I am searching for a website to have lots of Wordpress hacks and hooks. Some hooks like activating debug mode or etc. Can you give me lots of this futures ?


title: Newbie Question: How to create a "latest news" page showing a list of posts from blog category

text: I am using the Modest theme from elegant themes at http://lilsaintz.co.nz Under the slider on the homepage, there are three content areas that are generated from pages. I would like to make one of the content areas a "Latest News" element showing the last 5 posts from the blog (category = blog). Bearing in mind that I am a complete WP novice - although I am really good at following instructions :) - what would be the best way to go about doing this? Thank you!


title: How to output built-in widgets with number in range as class?

text: I'd like to make my theme mobile friendly by turning the widget-containers into touchable buttons, having their contents flying out when hovering. Therefor, I will have to absolutely position the content of each container a few pixels more than its previous one. Well, I could achieve that by planning how to arrange the widgets before the site goes live and then rely on the class-names WP generates commonly, but since I wanna leave the order up to the customer, this is not a solution. The trick would be to pass each widget a class name in regard to its position in range. Is there a way to do this?


title: Fallback if statement based on the number filtered from it

text:
I'm trying to add three ads on a page. I have a custom post type called 'ads' and I'm using advanced custom fields to add a start date an end date and an option to select which pages to associate them with. I want to set a fallback image for the ads if there aren't any ads that fit within this criteria..               if ( $start_date <= $current_date && $end_date >= $current_date && in_array( $page_id, $page_ids ) )      So lets say I have 6 ads setup and only 1 fits that criteria and is still active. The `else statement` doesn't take into consideration how many ads are active, so if there is only 1 ad active it will still show 3. I would like to have it only show the fallback ads if there are zero ads that fit in that `if statement` but can't figure out how to do that at this point in the loop. I have the `posts_per_page` set to unlimited because I need to filter them by date and pages associated with them, so I'm using `$i < 3` on the while loop to limit it to three ads from that point. Basically don't show any fallback ads unless there are zero ads that fit the `if statement`. This is probably more of a PHP question but it includes the wp loop so figured this would be the better place to ask. Anyone have any ideas? Thanks               <?php     $current_date = date('Ymd');     $page_object  = get_queried_object();     $page_id      = get_queried_object_id();          $args = array(         'post_type'      => 'ads',         'posts_per_page' => -1,         'orderby'        => 'rand'     );          $ads = new WP_Query( $args );          if ( $ads->have_posts() ) : $i = 0;         while ( $ads->have_posts() && $i < 3 ) : $ads->the_post();             $start_date = get_field( 'start_date' );             $end_date   = get_field( 'end_date' );             $link       = get_field( 'link' );             $display    = get_field( 'display_on_page' );             $page_ids   = array();                  // Store ID's in an array             foreach ( $display as $post_object ) {                 $page_ids[] = $post_object->ID;             }                  // Show ads that are inbetween start & end dates and match the page_ids selected             if ( $start_date <= $current_date && $end_date >= $current_date && in_array( $page_id, $page_ids ) ) {                 ?>

                         <a href="<?php echo $link; ?>"><?php the_post_thumbnail( 'ads' ); ?>

                 <?php             } else {                 // Will loop 3 times for fallback ads ?>

                         <img src="<?php bloginfo( 'template_url' ); ?>/images/ad-listing.jpg" alt="Advertisement">

                 <?php             }        $i++;        endwhile;     endif;     ?>


title: Use of global variables within plugin

text: I am creating my first plugin ever and I found my self having to call the same option variables within various parts of the same page therefore I sought for a solution and stumbled upon global variables which seems to be working for me, however after reading a few articles people seem to be against using global variables and also, I'm not entirely sure if I'm using them the correct way. Here is what I have;               /************************     * Variables     ************************/     global $bClass, $cClass, $dClass, $cExpiry;            $bClass = $cClass = $dClass = $cExpiry =  get_option('myoption');      Then since I use a single option to save relevant variables in an array, I would echo the value like this **jquery**               expires: <?php global $cExpiry; echo $cExpiry['cExpiry']; ?>,      and then I would also use it in other functions within the same page. So, it works for me, however I am still wondering whether I am doing it right. **update** Thanks for the explanation guys, I ended up using local variables and also found a mistake in my code; Since I have all my variables saved in a single option, I just used a single local variable;               $options = get_option('myoption');      Then I would get access to the array by placing the variable inside brackets               <?php echo $options['var1']; ?>      Whereas before I was doing `$bClass = $cClass = $dClass = $cExpiry = get_option('myoption');` which is bad.


title: How to add multiple values with add_query_arg?

text: Let's suppose I am on this url of my site http://demo.com/?cat=1+2+3 And now someone clicks on a link generated with add_query_arg(). How can I make this link go to http://demo.com/?cat=1+2+3+4 Im trying to create a taxonomy filter and this is what I have:               foreach ( $sub_terms as $st ) {         echo 'term_id ,"http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ) ).'" class="subterm">'. $st->name .'';     }      Instead of appending my term id to the url, it just replaces cat with the new value: http://demo.com/?cat=4 I hope it's clear enough Thanks!


title: Building a Member Directory Site on WordPress with Facebook API Integration?

text: I'm looking to build a member directory for one of my WordPress sites that hooks into the Facebook API. Site users would be able to browse through the directory of members and view their Facebook profile and information such as e-mail address, phone number, website, etc. Basically, I'm thinking that members will need to login to facebook from the site and "allow access." Then, WordPress can pull member data from Facebook such as e-mail address, phone number, website, etc. and store it as custom meta in WordPress. One problem with this approach would be when a user updated their facebook profile, the WordPress site wouldn't get updated until they log back into the site and the "update" process kicks off again. Am I way off base? Is there an easier way to do it? Is there anything that would get me started with this, or would it need to be built entirely from scratch?


title: Live blogging plugins?

text: What do you all use for live blogging? I've found Live Blogging by Chris Northwood (more than I need) and Twitter LiveBlog by Mashuqur Rahman (I want it to stay within WordPress). Are these really the only two games in town?


title: How can i loop through custom post type according to custom meta field?

text: I have a winery website with the custom post type "wine", each wine has various custom meta fields like "vintage", "pH", "Varietal-Composition" etc... Now, i would like to list all wines where vintage=2005. Any pointers?


title: Adding custom text in items titles from wp_nav_menu()

text: I need to add something after each title of a specific menu called by wp_nav_menu() I tried               add_filter('wp_nav_title', 'testing_stuff');      with               function testing_stuff() {     $item->title = $item->title . ' testing';     return $item->title;      } without any success, i'm not familiar enough with hooking. My purpose :   * when I called menu ID = 4;   * for each title of each item   * i pull out data from current page meta with $meta_value = get_post_meta( $post->ID, $meta_key, true );   * I add this data after the anchor text in a  So every item of the menu will have a specific data added to its content, data I could manipulate from custom field. I would appreciate any clue that get me on the right path. Thank you.


title: What should I write in the post action of this front end post form?

text:
I'm following this tutorial to build a front end form:               <?php     /**      *      * New Post Form for Custom Post Types for the Frontend of Your Site      * By Jared Williams - http://new2wp.com      *      * Last Updated: 8/30/2010      */          // Check if the form was submitted     if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) {              // Do some minor form validation to make sure there is content         if (isset ($_POST['title'])) {              $title =  $_POST['title'];          } else {              echo 'Please enter a title';         }         if (isset ($_POST['description'])) {              $description = $_POST['description'];          } else {              echo 'Please enter the content';          }         $tags = $_POST['post_tags'];              // Add the content of the form to $post as an array         $post = array(             'post_title'    => $title,             'post_content'  => $description,             'post_category' => $_POST['cat'],  // Usable for custom taxonomies too             'tags_input'    => $tags,              'post_status'   => 'publish',           // Choose: publish, preview, future, etc.             'post_type'     => $_POST['post_type']  // Use a custom post type if you want to         );         wp_insert_post($post);  // Pass  the value of $post to WordPress the insert function                                 // http://codex.wordpress.org/Function_Reference/wp_insert_post         wp_redirect( home_url() ); // redirect to home page after submit          } // end IF     // Do the wp_insert_post action to insert it     do_action('wp_insert_post', 'wp_insert_post');      ?>
         <form id="new_post" name="new_post" method="post" action="">
Title
             <input type="text" id="title" value="" tabindex="1" size="20" name="title" />

Description
             <textarea id="description" tabindex="3" name="description" cols="50" rows="6"></textarea>

<?php wp_dropdown_categories( 'show_option_none=Category&tab_index=4&taxonomy=category' ); ?>

Tags                 <input type="text" value="" tabindex="5" size="16" name="post_tags" id="post_tags" />

<input type="submit" value="Publish" tabindex="6" id="submit" name="submit" />
                  <input type="hidden" name="post_type" id="post_type" value="post" />             <input type="hidden" name="action" value="post" />             <?php wp_nonce_field( 'new-post' ); ?>         </form>
           Right now the action part:                   <form id="new_post" name="new_post" method="post" action="">      Is empty I tried two things: I tried placing the the whole code in a file called page-submit.php. I'm getting this: > It seems we can’t find what you’re looking for. Perhaps searching, or one of > the links below, can help. I also tried placing the php part in a file called frontpost.php. and adding this:               <form id="new_post" name="new_post" method="post" action="<?php echo get_template_directory_uri(); ?>/frontpost.php">      to the action. But I get a Server Error. Any suggestions to fix this?


title: How to use custom stylesheet only for a template in child theme

text: I am using Themco's X theme. To modify the theme styles I used the Ethos child theme provided by Themeco. I have designed a custom template in the child theme. Now I want a stylesheet custom-style.css to be used only for that theme. But when I use this                   <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/custom-style.css">      the link that comes up is that of the parent theme rather than the child theme. What else can be done to use that stylesheet only for that template? Please note I don't want that stylesheet to be used in any other template.


title: How to Require a Minimum Image Dimension for Uploading?

text: I need a way to restrict authors from uploading a images bellow a specific dimensions. Say I only want to allow uploading images that are at least 400px x 400px. If the image size is smaller, the author should get an error notice that the image is too small. Is there a plugin or code that can accomplish this?


title: A custom jquery posts slideshow?

text: I would like to hvae something like which is under LATEST ARTICLES: http://themeforest.net/item/equilibrium-clean-and-modern-wp-portfolio- theme/full_screen_preview/505517 I can quite easily build it with jquery slide effect, but I have no idea how to make it update automatically everytime I submit a new post. So, does anybody know how could I build this feature for my blog or maybe there is a plugin for this feature? Thanks!


title: Problem enabling the user to edit Markdown and displaying the HTML output (WMD Editor plugin for Wordpress)

text: Here is the WMD Editor implementation for Wordpress. **When the users writes a post everything is displayed OK:** ![enter image description here](http://i.stack.imgur.com/1RDFw.png) ![enter image description here](http://i.stack.imgur.com/ijfV3.png) **The problem is when the user clicks EDIT:** ![enter image description here](http://i.stack.imgur.com/lLNTE.png) The HTML version is the one displayed (I think it is a normal behaviour since WMD Editor turned the Markdown version of the post into HTML). What are the steps to fix this? or IS there a new version which solves this? (I checked other questions but no one gives a concrete solution).


title: Star rating for custom post types

text: I need to add star ratings to one of my custom post types. At first I coded them myself but when the rating challenge came along i thought about using a plugin instead, so I used easy post types. I've tried a couple star rating plugins and none of them seem to work. For example, with WP-PostRatings, I used the next code in my single- customposttype.php:               <?php if(function_exists('the_ratings')) { the_ratings(); } ?>      The image shows, but clicking does nothing. The same thing happens with other plugins. Star Ratins only says "an error ocurred" but no other debug info is displayed. So I don't know if you could recommend alternate plugins or any alternate method to add the star rating feature for my custom post type, because can't get it work as it is.


title: Google Analytics always shows at least two page views per visit - What can cause this?

text: I'm using Google Analytics on my wordpress blog, and I'm seeing some suspicious numbers:   * very low bounce rate (less than 1%)   * when doing the live view, I always see page views as a multiple of two My other blogs do not show this behavior. My suspicion is that the page count is sent twice to google, but I have no idea why this would be the case. I'm using a plugin called "Google Analyticator" to track my blog. To the best of my knowledge (I looked through my template's files), there are no "direct" calls to Google. What can I do to further track down this issue?


title: How to get pages id in array in get_pages?

text: $page1 = get_option('home_page_field');     $page2 = get_option('home_page_field1');     $page3 = get_option('home_page_field2');     $page4 = get_option('home_page_field3');                $arrData = array( $page1, $page2 , $page3 );      its giving o/p as               Array ( [0] => Array ( [text_string] => 2 ) [1] => Array ( [text_string] => 499 ) [2] => Array ( [text_string] => 869 ) )      how can i set get_pages function to get the all info about the pages with these pages ids with me PLease help Thanks


title: Limiting title characters in the AZIndex plugin

text: I am using the AZIndex plugin to list post titles in my site and i would now like to limit the title characters, how would i do that?


title: Have working sql query... trying to adjust it to use $wpdb

text: So I have this code that queries a custom plugin generated table in the wp database. It works perfectly as is. But I'm trying to adjust it to use $wpdb instead of the $con function I have set up. Here is the code that works perfectly, but not using $wpdb:               <?php     $q = strtolower($_GET["q"]);     if (!$q) return;     $isArabic = is_arabic($q);          $con=mysql_connect("localhost","admin","*****");     if($con){         mysql_select_db("arabic_student",$con);     }     else{         die("Could not connect to database");     }          mysql_query("SET NAMES utf8");     $sql = "SELECT DISTINCT en_word, ar_word FROM wp_enar_words WHERE en_word LIKE '$q%' OR ar_word LIKE '$q%'";     $rsd = mysql_query($sql) or die(mysql_error());          if($isArabic){              while($rs = mysql_fetch_array($rsd)) {             $en_word = $rs['en_word'];             $ar_word = $rs['ar_word'];                  echo "$ar_word\n";     }     }else{         while($rs = mysql_fetch_array($rsd)) {             $en_word = $rs['en_word'];             $ar_word = $rs['ar_word'];                  echo "$en_word\n";          }     }     ?>      Here is my noob attempt to use $wpdb:               global $wpdb;     $sql = $wpdb->get_results("SELECT en_word, ar_word FROM wp_enar_words WHERE en_word LIKE   '$q%' OR ar_word LIKE '$q%'");     $rsd = $wpdb->query('$sql');      But it gets a Fatal error: Call to a member function get_results() on a non- object in.... So maybe missing something obvious but hoping I could get some guidance on how to port my existing code to using $wpdb. Thanks in advance! * * * **UPDATE:** so I'm starting to think that the problem is that this code is being called with a jquery plugin. I'm using jquery autocomplete and calling the above php code to populate the form autocomplete:               $("#search_words").autocomplete("<?php bloginfo('template_directory'); ?>/search_ac.php", {});      Could this be the problem? I'm confused because my original code that directly calls the database works perfectly, but once I use $wpdb, it no longer functions


title: Custom Post Type to override theme's CSS & HTML from Plugins Dir?

text: I have a plugin that creates a custom post type called Squeeze Pages. It has various short codes users can enter to make a squeeze page but I'm not sure how I can go about making the squeeze pages have a custom design, completely different from the homepage. Is this possible? If so, how can it be done?


title: How to use get_template part in the plugin?

text: I was using the entire template in the plugin, but I would like to use get template part, so that I can reuse the header and footer in the original template. The code is like this:               add_filter( 'page_template', 'template_reg' );     function template_reg()     {       if ( is_page( ourdoctors_single_pg() ) ) {              $page_template = dirname( __FILE__ ).'/templates/OurDoctors.php';       return $page_template;            }       Is there any way that I can use partial template instead of entire template? I tried to use `get_template_part`, but it seems like I have to put template in the theme. But how to put the template in the plugin?


title: How do I manage my users post before publish?

text: In my website , I allow to the new user to write posts. but the problem is when the user write post. the state of post is publish. it is appear in front page. I want to read it before the publish , I mean I want to approve it if it is useful or refuse it if it unuseful. I wish you understand me. Thank you very much ,


title: Plugin development with unit tests

text: One of the things that my plugin does is creates a number of SQL tables as part of a versioning function (that is run under the admin_init hook as I couldn't find a better wordpress way of doing things). I call the initialisation script as part of the setUp routine and theorectically should be dropped as part of the tearDown routine. In essence here is the basic stub of what I'm (unsuccessfully) doing:               class GFDL_test extends WP_UnitTestCase {     public $plugin_slug = 'gfdl';     protected $users = array();          function setUp() {         parent::setUp();         include_once(/* path for gfdl_versioning function*/);         GFDataLayer::init_globals();         gfdl_versioning(); /* this creates the tables */              /* add test users (to give them a role add a 'role' parameter to this add user) */         $this->users[0] = wp_insert_user(array('user_login' => 'test1'));         $this->users[1] = wp_insert_user(array('user_login' => 'test2'));     }          function tearDown() {         global $wpdb;         /* these lines don't work for some reason */         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'gfdl_bullets;');         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'gfdl_character_ai;');         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'gfdl_items;');         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'gfdl_sprites;');         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'gfdl_backgrounds;');              wp_delete_user($this->users[0]);         wp_delete_user($this->users[1]);         parent::tearDown();     }          function testDatalayer() {         $this->assertTrue(class_exists( 'GFDataLayer'));     }          function testVersion() {         $this->assertEquals('0.11', get_option('gfdl_version'));     }     }      The tear down function appears to be executing but the drop tables aren't working (they remain after the unit tests are finished). My first thought is that the tests were being executed asynchronously but my debugging is suggesting otherwise. Is there a better way in handling plugin upgrades (in respect to database changes) or is there something that I'm missing?


title: get_template_directory vs get_stylesheet_directory

text: I am trying to create a child theme and need to replace some files that are in sub-folders. In this post, it states > `'get_stylesheet_directory();` will go to the current theme, child or parent Why don't theme developers just use `get_stylesheet_directory()` if it would work for the parent or child theme? It seems that I now have to change every reference to `get_template_directory()` to get my child files to work (that are in sub- folders) or is there another way of doing this? This post by Andrew Nacin states that, > you can just replace files directly in a child theme. But it seems that this only works for one level deep. Is there a way for this to work with more than one level and would this be easier than changing each reference to `get_template_directory()`?


title: Why is $wpdb->get_results failing on certain tables but not others (which have data)?

text: I'm trying to pull some custom data from a Cart66 table. My code works whenever I pull results from standard WP table in (my array is populated and the print_r shows that data), but not with any Cart66 tables (it prints an empty array). I am absolutely certain that I've got data in these tables (I've rechecked that I'm using the correct table names about 1,000,000 times). I've tried two Cart66 tables which have data in them. The codex says the get_results class should work with any table, not just standard tables. I thought it might be the underscore that was causing trouble, but underscores are supposed to be fine, and indeed, standard WP tables with underscores work fine.               $rawproducts = $wpdb->get_results( "SELECT * FROM $wpdb->cart66_products" );     print_r($rawproducts);      This is maddening! Any ideas? Thanks!


title: Allowing access to certain Wordpress created pages or posts with htaccess / htpasswd

text: Trying to figure out how to give access to a certain page, lets say `http://mypage.com/page` and not letting people access the main index via `http://mypage.com`. Or just simply disallow access to `http://mypage.com` and let people be able to input whatever subdirectory they want and let through if the page do exist. Is this possible to achieve with Wordpress? `/page` is created by Wordpress and not some HTML page I want to give access to. Tried this but with no luck               AuthUserFile path/to/.htpasswd     AuthName "Gone fishin', come back soon"     AuthType Basic     <Files "index.php">       require valid-user     </Files>


title: How does WooCommerce display a custom comment_type in Comment Admin?

text: There have been many threads and topics over the past few years about how to create a custom comment type. For the most part it's my understanding that it's possible (because WooCommerce does it) but recommended to use `comment_meta` instead. My question is how does WooCommerce add the `comment_type` of `order_note` to the dropdown in Comment Administration? A regrex of WooCommerce's code turns up nothing helpful. Any direction is appreciated. _Example of adding a comment with the type of`order_note`:_               /**      * Adds a note (comment) to the order      *      * @access public      * @param string $note Note to add      * @param int $is_customer_note (default: 0) Is this a note for the customer?      * @return id Comment ID      *      * *file is class-wp-order.php*      */     public function add_order_note( $note, $is_customer_note = 0 ) {              $is_customer_note = intval( $is_customer_note );              if ( is_user_logged_in() && current_user_can( 'manage_woocommerce' ) ) {             $user                 = get_user_by( 'id', get_current_user_id() );             $comment_author       = $user->display_name;             $comment_author_email = $user->user_email;         } else {             $comment_author       = __( 'WooCommerce', 'woocommerce' );             $comment_author_email = strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@';             $comment_author_email .= isset( $_SERVER['HTTP_HOST'] ) ? str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) : 'noreply.com';             $comment_author_email = sanitize_email( $comment_author_email );         }              $comment_post_ID        = $this->id;         $comment_author_url     = '';         $comment_content        = $note;         $comment_agent          = 'WooCommerce';         $comment_type           = 'order_note';         $comment_parent         = 0;         $comment_approved       = 1;         $commentdata            = apply_filters( 'woocommerce_new_order_note_data', compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_agent', 'comment_type', 'comment_parent', 'comment_approved' ), array( 'order_id' => $this->id, 'is_customer_note' => $is_customer_note ) );              $comment_id = wp_insert_comment( $commentdata );              add_comment_meta( $comment_id, 'is_customer_note', $is_customer_note );              if ( $is_customer_note )             do_action( 'woocommerce_new_customer_note', array( 'order_id' => $this->id, 'customer_note' => $note ) );              return $comment_id;     }      _Previous question: The project I'm working on right now would be much, much easier if I could just add a`comment_type` in addition to `comment_meta` where appropriate. My question is where should I be looking for a guide/example on how to do this?_


title: Admin Menu new tab external link

text: In a clients site i needed to add a menu item under the dashboard, this link is to go to a external url. i managed this with the following code:               add_dashboard_page( 'redirecting', 'Docs', 'read', 'docs', 'redirect_docs');          function redirect_docs(){         wp_redirect( URL_HERE );          exit;     }      This worked fine upto now. My client has now asked me to make the link open in a new tab/window and not change the current page. Is this possible? If so any suggestions how? Thanks Sofia xXx


title: no emails for a user account

text: Is it possible to create a user account without an email. Just a username? I saw that there is a plugin to allow multiple authors under one email. Does anyone have any recommendations on other ways to do this. I know this not ideal but I have one user who will posting on behalf of multiple users. Having the user verify their email through gravatar for each new author is a http://coffee2code.com/wp-plugins/allow-multiple-accounts/


title: Make slug as ID Number for custom post types

text: I want to make the slug for each of my custom post types to be the post ID number. How do I do this? None of my posts accept post title, content, or anything else - they require different data which was easier to display as a meta box). To illustrate: I have a CPT ('eduation'). When I submit the post into the database, it has an ID of, say, 15. When I visit mysite.com/edu/15 ('edu' being the post slug that I have set), I see the details from this post in my site. I know I could simply change the permalinks, but I want those to stay as they are; I just want to change the ones for these custom post types. Sorry if the question is confusing. It probably is really simple to answer, but I really don't know what the answer is.


title: How to change default media attachment link to something user defined in post or page?

text: Whenever I upload image in post or page, I upload two version, one to display on the site and another for watermark. Whenever someone click on the image, watermarked image is displayed. If the image name is _abc.jpg_ , watermarked image name is _abc-wm.jpg_. Is there anyway, I can automate this process. So, whenever, I upload image _abc.jpg_ , the attachment url is changed to _abc- wm.jpg._ I tried with several alternatives. Please help you can find solution for this. Thanks in advanced. Help is really appreciated.


title: How to customize woocommerce single-product.php tabs

text: I want to customize the tabs in single-product page of woocommerce (description,reviews, etc.) with html and css so that they work in java script disabled environment. I have followed a write up to do the same in case of My- Account.php http://www.mclanecreative.com/customizing-the-woocommerce-my- account-page-with-tabs-using-css-html/ Which template should I modify and how?


title: Disable WooCommerce SKU on Product Page

text: I have a WooCommerce store and I don't want to display the SKU on any single product page. Looking at their code, I found this filter:               /**      * Returns whether or not SKUS are enabled.      * @return bool      */     function wc_product_sku_enabled() {         return apply_filters( 'wc_product_sku_enabled', true );     }      and I attempted to override it with this line of code I placed in a custom plugin:               apply_filters( 'wc_product_sku_enabled', false );      I also tried placing the apply_filter inside an action function for woocommerce_product_meta_start which fires right before but it still renders the SKU on the product page. Any ideas?


title: How to cache custom pages using W3 Total Cache?

text: Some posts are requested through Ajax.               <?php     // Filename: ajax-posts.php     require_once "wp-load.php";     echo my_get_post($_GET["id"]);     ?>      How can I make theese Ajax requests cacheable by W3 Total Cache?


title: How to increase password requirements for registration

text:
Ok I have buddypress installed which lets users choose a password at registration but it has zero requirements for it only asking that it be entered twice. So you can have a single character password which is ridiculous. So I found the function that validates it when the register form is submitted but I can't figure out how to hook into it correctly to add a simple check to make sure there are at least 6 characters. So first here is the buddypress core function.               function bp_core_screen_signup() {     global $bp;          if ( !bp_is_current_component( 'register' ) )         return;          // Not a directory     bp_update_is_directory( false, 'register' );          // If the user is logged in, redirect away from here     if ( is_user_logged_in() ) {         if ( bp_is_component_front_page( 'register' ) )             $redirect_to = trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() );         else             $redirect_to = bp_get_root_domain();              bp_core_redirect( apply_filters( 'bp_loggedin_register_page_redirect_to', $redirect_to ) );              return;     }          $bp->signup->step = 'request-details';          if ( !bp_get_signup_allowed() ) {         $bp->signup->step = 'registration-disabled';          // If the signup page is submitted, validate and save     } elseif ( isset( $_POST['signup_submit'] ) && bp_verify_nonce_request( 'bp_new_signup' ) ) {              do_action( 'bp_signup_pre_validate' );              // Check the base account details for problems         $account_details = bp_core_validate_user_signup( $_POST['signup_username'], $_POST['signup_email'] );              // If there are errors with account details, set them for display         if ( !empty( $account_details['errors']->errors['user_name'] ) )             $bp->signup->errors['signup_username'] = $account_details['errors']->errors['user_name'][0];              if ( !empty( $account_details['errors']->errors['user_email'] ) )             $bp->signup->errors['signup_email'] = $account_details['errors']->errors['user_email'][0];              // Check that both password fields are filled in         if ( empty( $_POST['signup_password'] ) || empty( $_POST['signup_password_confirm'] ) )             $bp->signup->errors['signup_password'] = __( 'Please make sure you enter your password twice', 'buddypress' );              // Check that the passwords match         if ( ( !empty( $_POST['signup_password'] ) && !empty( $_POST['signup_password_confirm'] ) ) && $_POST['signup_password'] != $_POST['signup_password_confirm'] )             $bp->signup->errors['signup_password'] = __( 'The passwords you entered do not match.', 'buddypress' );         $pass = $_POST['signup_password'];              $bp->signup->username = $_POST['signup_username'];         $bp->signup->email = $_POST['signup_email'];              // Now we've checked account details, we can check profile information         if ( bp_is_active( 'xprofile' ) ) {                  // Make sure hidden field is passed and populated             if ( isset( $_POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {                      // Let's compact any profile field info into an array                 $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );                      // Loop through the posted fields formatting any datebox values then validate the field                 foreach ( (array) $profile_field_ids as $field_id ) {                     if ( !isset( $_POST['field_' . $field_id] ) ) {                         if ( !empty( $_POST['field_' . $field_id . '_day'] ) && !empty( $_POST['field_' . $field_id . '_month'] ) && !empty( $_POST['field_' . $field_id . '_year'] ) )                             $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] ) );                     }                          // Create errors for required fields without values                     if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )                         $bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );                 }                  // This situation doesn't naturally occur so bounce to website root             } else {                 bp_core_redirect( bp_get_root_domain() );             }         }              // Finally, let's check the blog details, if the user wants a blog and blog creation is enabled         if ( isset( $_POST['signup_with_blog'] ) ) {             $active_signup = $bp->site_options['registration'];                  if ( 'blog' == $active_signup || 'all' == $active_signup ) {                 $blog_details = bp_core_validate_blog_signup( $_POST['signup_blog_url'], $_POST['signup_blog_title'] );                      // If there are errors with blog details, set them for display                 if ( !empty( $blog_details['errors']->errors['blogname'] ) )                     $bp->signup->errors['signup_blog_url'] = $blog_details['errors']->errors['blogname'][0];                      if ( !empty( $blog_details['errors']->errors['blog_title'] ) )                     $bp->signup->errors['signup_blog_title'] = $blog_details['errors']->errors['blog_title'][0];             }         }              do_action( 'bp_signup_validate' );              // Add any errors to the action for the field in the template for display.         if ( !empty( $bp->signup->errors ) ) {             foreach ( (array) $bp->signup->errors as $fieldname => $error_message ) {                 // addslashes() and stripslashes() to avoid create_function()                 // syntax errors when the $error_message contains quotes                 add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "
" . stripslashes( \'' . addslashes( $error_message ) . '\' ) . "
" );' ) );             }         } else {             $bp->signup->step = 'save-details';                  // No errors! Let's register those deets.             $active_signup = !empty( $bp->site_options['registration'] ) ? $bp->site_options['registration'] : '';                  if ( 'none' != $active_signup ) {                      // Make sure the extended profiles module is enabled                 if ( bp_is_active( 'xprofile' ) ) {                     // Let's compact any profile field info into usermeta                     $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );                          // Loop through the posted fields formatting any datebox values then add to usermeta - @todo This logic should be shared with the same in xprofile_screen_edit_profile()                     foreach ( (array) $profile_field_ids as $field_id ) {                         if ( ! isset( $_POST['field_' . $field_id] ) ) {                                  if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) {                                 // Concatenate the values                                 $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];                                      // Turn the concatenated value into a timestamp                                 $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) );                             }                         }                              if ( !empty( $_POST['field_' . $field_id] ) )                             $usermeta['field_' . $field_id] = $_POST['field_' . $field_id];                              if ( !empty( $_POST['field_' . $field_id . '_visibility'] ) )                             $usermeta['field_' . $field_id . '_visibility'] = $_POST['field_' . $field_id . '_visibility'];                     }                          // Store the profile field ID's in usermeta                     $usermeta['profile_field_ids'] = $_POST['signup_profile_field_ids'];                 }                      // Hash and store the password                 $usermeta['password'] = wp_hash_password( $_POST['signup_password'] );                      // If the user decided to create a blog, save those details to usermeta                 if ( 'blog' == $active_signup || 'all' == $active_signup )                     $usermeta['public'] = ( isset( $_POST['signup_blog_privacy'] ) && 'public' == $_POST['signup_blog_privacy'] ) ? true : false;                      $usermeta = apply_filters( 'bp_signup_usermeta', $usermeta );                      // Finally, sign up the user and/or blog                 if ( isset( $_POST['signup_with_blog'] ) && is_multisite() )                     $wp_user_id = bp_core_signup_blog( $blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta );                 else                     $wp_user_id = bp_core_signup_user( $_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta );                      if ( is_wp_error( $wp_user_id ) ) {                     $bp->signup->step = 'request-details';                     bp_core_add_message( $wp_user_id->get_error_message(), 'error' );                 } else {                     $bp->signup->step = 'completed-confirmation';                 }             }                  do_action( 'bp_complete_signup' );         }          }          do_action( 'bp_core_screen_signup' );     bp_core_load_template( apply_filters( 'bp_core_template_register', array( 'register', 'registration/register' ) ) );     }        add_action( 'bp_screens', 'bp_core_screen_signup' );      So that's nice and huge but at line 90 the password validation starts and is just checking to make sure they match. I tried hooking into it but I'm not understanding the concept.               function bp_password_beefing() {      if ( !empty( $_POST['signup_password'] ) )        if ( strlen( $_POST['signup_password'] ) < 6 )         $bp->signup->errors['signup_password'] = __( 'Your password needs to be atleast 6 characters', 'buddypress' );        }      add_action( 'bp_signup_pre_validate', 'bp_password_beefing');      What's the correct way to do this?


title: Login redirect to previous page

text: I have a custom login page at http://netballscoop.com/log-in/ When you fill the username and password it redirects you to the previous page you were on perfectly. When you click Log Out it redirects you to the same page. So this all works well. If you leave the username/password blank or have an error it will lead you to wp-login. To prevent this I have used the code from http://stackoverflow.com/questions/11477107/redirect-away-from-login-page               add_action('login_redirect', 'redirect_login', 10, 3);     function redirect_login($redirect_to, $url, $user) {     if($user->errors['empty_password']){         wp_redirect(get_bloginfo('url').'/log-in-error/');     }     else if($user->errors['empty_username']){         wp_redirect(get_bloginfo('url').'/log-in-error/');     }     else if($user->errors['invalid_username']){         wp_redirect(get_bloginfo('url').'/log-in-error/');     }     else if($user->errors['incorrect_password']){         wp_redirect(get_bloginfo('url').'/log-in-error/');     }     else{         wp_redirect(get_bloginfo('url').'/log-in');     }     exit;     }      This works great for log in errors on my website. But now the login redirect takes you to http://netballscoop.com/members/testing (The user 'Testing' is taken tor their BuddyPress member's profile page). How do I redirect the user to the previous page when they log in?


title: Methods to display images without plugin?

text: Are these the only methods to display an image (for wordpress.org) without a plugin?   1. Insert image into the editor area along with the text    2. Custom fields    3. the_post_thumbnail() What are the drawbacks of using custom fields for images? Is it correct that for Method 1, you cannot float the image and text differently because images and text in the_content() are all assigned a p tag - am I wrong? For example, is it possible to use Method 1 to create the layout below: ![enter image description here](http://i.stack.imgur.com/NwZpj.jpg)


title: Upload image from a URL and assign it as a Featured Image to a Custom Post Type?

text: I am 90% done building a plugin that uses the Amazon.com API. What I have built is a **Books** Custom Post Type. My Books CPT has Custom Taxonomies for **Book Category** , **Book Tags** , **Book Author** , and **Book Publisher/company** I then have a Settings page that allows you to Import a list of Books from Amazon using there API, you insert the ASIN ID number, 1 per line in a textarea field and then I import each book as a Book CPT and assign the custom taxonomies listed above. The only thing I am missing at this point is the ability to upload the image that is returned from the Amazon API, I get a URL to the image. I need to upload the image and assign it as the **Featured Image** for the post it is creating. I have not been able to find a solution for this yet, can anyone help with some code to upload an image in WordPress from a URL and then assign it as a featured image to a post?


title: Add a Second Menu to a theme that only support 1 menu

text:
I am no programmer but I can usually work stuff like this out when I read the code. I have a theme called Infinity which only supports 1 menu. I know how to do CSS etc but I can't find how I would a second menu. In fact it doesn't have to be a custom menu but just the pages. Can anyone tell me how to do this? An excerpt of the code is below which appears to load the menu:

     <?php get_template_part( 'custom', 'header' ); ?>

       <?php get_template_part( 'primary', 'menu' ); ?>

      This code is in the header.php. I search for primary primary-menu.php and found this in it:               <?php     /** Primary Menu Callback */     function infinity_primary_menu_cb() {         wp_page_menu();           }     ?>

           <?php           if ( has_nav_menu( 'infinity-primary-menu' ) ):                  $args = array(                      'container' => 'div',                  'container_class' => 'primary-container',                  'theme_location' => 'infinity-primary-menu',                 'menu_class' => 'sf-menu1',                 'depth' => 0,                 'fallback_cb' => 'infinity_primary_menu_cb'                  );                  wp_nav_menu( $args );                else:                  infinity_primary_menu_cb();                 endif;           ?>

      Any help? EDIT: Update. Functions page pasted below               <?php     /** Load the Core Files */     require_once( trailingslashit( get_template_directory() ) . 'lib/init.php' );     new Infinity();          /** Do theme setup on the 'after_setup_theme' hook. */     add_action( 'after_setup_theme', 'infinity_theme_setup' );          /** Theme setup function. */     function infinity_theme_setup() {              /** Add theme support for core framework features. */         add_theme_support( 'infinity-core-menus', array( 'infinity-primary-menu' ) );         add_theme_support( 'infinity-core-sidebars', array( 'infinity-primary-sidebar' ) );         add_theme_support( 'infinity-core-featured-image' );         add_theme_support( 'infinity-core-custom-header' );              /** Add theme support for WordPress features. */         add_theme_support( 'automatic-feed-links' );         add_theme_support( 'custom-background', array( 'default-color' => 'fafafa' ) );              /** Set content width. */         infinity_set_content_width( 600 );              /** Add custom image sizes. */         add_action( 'init', 'infinity_add_image_sizes' );             }          /** Adds custom image sizes */     function infinity_add_image_sizes() {         add_image_size( 'featured', 200, 200, true );     }     ?>      Menu code below               function infinity_register_menus() {              /** Get theme-supported menus. */         $menus = get_theme_support( 'infinity-core-menus' );              /** If there is no array of menus IDs, return. */         if ( !is_array( $menus[0] ) ) {             return;         }              /* Register the 'primary' menu. */         if ( in_array( 'infinity-primary-menu', $menus[0] ) ) {             register_nav_menu( 'infinity-primary-menu', __( 'Infinity Primary Menu', 'infinity' ) );         }


title: Unable to show messages using 'admin_notices'

text:
The plugin I am working on has a table in the admin area with a single entry corresponding to single row. The admin has an option to perform certain actions on the table contents one of them being edit. All works well and the js script is as follows -               jQuery(document).ready(function($){          $(".edit").click(function(){              var first_class = $(this).attr('class').split(" ")[0];         var message = "message"+first_class;         var content = jQuery("#"+message).text();         var $dialog = $("

").html("<textarea style='width:99%; height:90%' class='popup-content'>"+content+"</textarea>").dialog({             height: 400,             width: 400,             title: 'My Data',             modal: true,             autoOpen: false,             dialogClass: 'wp-dialog',             buttons: {                 "Save": function(){                     $("#"+message).html($(".popup-content").val());                     $.ajax({                         type: "post",                         url: script_data.admin_ajax,                         data: {                             action: "feedmng_update",                             feed_id: first_class,                             feed_msg: $(".popup-content").val()                         },                         error: function(xhr, status, error) {                             console.log(xhr, error, status);                         },                         success: function(){                             $dialog.dialog("close");                         }                     });                 }             }         });         $dialog.dialog("open");         });     });      As can be seen, on clicking Save button, Ajax call is made to update the databse, which works well too. Now I want to display a message that the database has been updated, but I cant seem to do it right. Here is the php code -               function feedmng_update(){              global $wpdb;         //$tablename = $wpdb->prefix. "feedmanager";         $feedid = $_REQUEST["feed_id"];         $feedmsg = $_REQUEST["feed_msg"];         $wpdb->update( 'wp_feedmanager', array( 'message' => $feedmsg ), array( 'id' => $feedid ) );         add_action( 'admin_notices', array( &$this, 'feedmng_edit_notif' ) );     }          function feedmng_edit_notif(){              ?>

<?php echo "Message succesfully edited"; ?>

         <?php     }      Action hook for ajax -               add_action( 'wp_ajax_feedmng_update', array( &$this, 'feedmng_update' ) );      Is there a way to get it working ?


title: Auto Populate Excerpt Field

text: How do auto populate the excerpt field with the first 15 words of the post content? I found this snippet:               function wps_excerpt_content( $content ) {         $content = "YOUR EXCERPT HERE";         return $content;     }     add_filter( 'default_excerpt', 'wps_excerpt_content' );      But I don't know how to modify it with what I need. Any help?


title: Inserting specific images inside navigation menu

text: I have a navigation menu that I hard-coded into a recent theme that I developed. Now, it would be a lot easier (and more customizable) to just build this navigation menu using the intrinsic `wp_list_pages()` function via the wordpress administration panel. There is one catch though. Some of the drop- downs have an image on the left of it. Each drop down only has one image, but the image is different for each drop down. Is there a way I can incorporate this image in the user-interface administration of wordpress? Such as build the menu in Wordpress and have a field where I can choose which picture I want in the dropdown. Thanks!


title: Lock user information once fields have been filled in

text: Much like the username is locked down and cannot be changed once it has been registered, I would like to lock down additional fields I have created with Advanced Custom Fields like the person's cellphone number which is vital for us to have because it is linked to a security gate entrance and should not be changed What I need to be able to have happen is that once someone completes a field and submits their new information, that field needs to be locked down when the page reloads and only an administrator can change it. I know this can be done with javascript but I want to be sure that someone who knows how to use the Developer Toolbar is not able to change the field attribute and submit or delete content. Or if someone just happens to have JS switched off, they would be able to change this. Is there a WordPress hook that exists to do something like this please? Here's what I have found, none of which supports my solution.   1. http://wordpress.org/support/topic/how-to-disable-profile-fields   2. http://adambrown.info/p/wp_hooks/version/3.6 (to see if a hook like this exists) **EDIT:** I am already making use of the jQuery to check the fields that need to stay locked and disabling them but what I prefer to know is if there are any hooks one could use to do this in WP due to the fact that someone might be know how to bypass this with enough knowledge of Dev Toolbar? I have also done a ton of searches and nothing as specific as what I am trying to do here. Many thanks


title: Special Query: Title, Terms, Content - %LIKE%

text: I'm working on a them theme that is search-heavy, and my users are putting huge priority on an improved search function. I think I will have to use a special direct query to search these things:   1. Terms   2. Title   3. Content And allow flexibility such as:   1. Word fragments (search **bread** , finds **wonderbread** )   2. Phrases (search Orange Man, returns post with **man** in title, **orange** in terms) Without asking anyone to re-invent the wheel, **I was wondering if any such direct query example existed that I can modify to the needs of my custom post type** (and possibly taxonomy). I have no doubt many have wondered the same thing in various projects.


title: how to remove user name and date in post page

text: Every post page shows user name and date in top of page. Pinboard theme is used. Wordpress is used like CMS and this info in not nessecary. Pages cannto used since pages does not allow to add tags and cannot used as slider images in pinboard. How to remove user and date ? There are also categories and Edit buttons. If this is simpler, they can removed also so that whole line can removed. If possible, categories link may remain.


title: Redirect User to custom URL after registering

text:
I modified the default Wordpress registration page to include a role and also payment fields. I am adding a Gold Member feature the my website, which requires payment. I'd like it that after this user makes a payment and it is approved, he gets redirected back to the home page. I'm using the registration_errors filter to achieve this. This is not working, the user is instead redirected back to the wp-login page with a successful message on top. Additionally, the wp_update_user function is not working either; the user is added to the db with the default role - Subscriber. How do I pass the user_id in here? Or, should I do this in another place.               function process_payment($errors, $sanitized_user_login, $user_email) {          if ( $errors->get_error_code() ) return $errors;          global $tran;          if($tran->Process()) {         $approved = $tran->authcode;         add_filter('registration_redirect', 'gold_login_redirect');                 wp_update_user( array ('ID' => $user_id, 'role' => 'gold_member') ) ;          } else {         $errors->add( 'fidelipay_response', __('Declined:'. $tran->result . '
' . $tran->error . '
' . $tran->cvv2_result . '
' ,'mysite.com') );             if($tran->curlerror) {                 $errors->add( 'fidelipay_response', __('Reason:' . $tran->curlerror, 'mysite.com'));                    return $errors;              }             return $errors;                                                              }       return $errors;     }          add_filter('registration_errors', 'process_payment', 10, 3);          function gold_login_redirect() {          return home_url('?role=gold_member');     }


title: web.config breaks the themes for sub-directory multisite

text: We are converting a single wordpress site to a sub-directory network but we can't find any web.config that works correctly. We can never get the theme to work, not even on the root (/) site, as soon as we change the single-site web.config for a multisite one it breaks. I have been searching for hours and have found several topics where people have found a web.config that works but none works for us, the theme is always broken. The setup we want is this: http://www.domain.com/ (main site) http://www.domain.com/en/ (English version of the site) I did get it working to an extent on my own Apache server except it tried looking for media in /en/media/ when it should just have been /media/. However the host we use use IIS apparently. **Here is one web.config I've tried which lets me access the dashboard for all sites and everything seems to work except for the theme** :               <?xml version="1.0" encoding="UTF-8"?>     <configuration>     <system.webServer>         <rewrite>             <rules>                 <rule name="WordPress Rule 1" stopProcessing="true">                     <match url="^index\.php$" ignoreCase="false" />                     <action type="None" />                 </rule>                 <rule name="WordPress Rule 2" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />                     <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />                 </rule>                 <rule name="WordPress Rule 3" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />                     <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />                 </rule>                 <rule name="WordPress Rule 4" stopProcessing="true">                     <match url="^" ignoreCase="false" />                     <conditions logicalGrouping="MatchAny">                         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />                     </conditions>                     <action type="None" />                 </rule>                 <rule name="WordPress Rule 5" stopProcessing="true">                     <match url="(^[_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />                     <action type="Rewrite" url="{R:2}" />                 </rule>                 <rule name="WordPress Rule 6" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />                     <action type="Rewrite" url="{R:2}" />                 </rule>                 <rule name="WordPress Rule 7" stopProcessing="true">                     <match url="." ignoreCase="false" />                     <action type="Rewrite" url="index.php" />                 </rule>             </rules>         </rewrite>     </system.webServer>     </configuration>      Here is the web.config that the Wordpress network setup page suggest, this one makes the /en/ site dashboard 404:               <?xml version="1.0" encoding="UTF-8"?>     <configuration>     <system.webServer>         <rewrite>             <rules>                 <rule name="WordPress Rule 1" stopProcessing="true">                     <match url="^index\.php$" ignoreCase="false" />                     <action type="None" />                 </rule>                 <rule name="WordPress Rule 2" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />                     <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />                 </rule>                 <rule name="WordPress Rule 3" stopProcessing="true">                     <match url="^" ignoreCase="false" />                     <conditions logicalGrouping="MatchAny">                         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />                     </conditions>                     <action type="None" />                 </rule>                 <rule name="WordPress Rule 4" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />                     <action type="Rewrite" url="{R:1}" />                 </rule>                 <rule name="WordPress Rule 5" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />                     <action type="Rewrite" url="{R:2}" />                 </rule>                 <rule name="WordPress Rule 6" stopProcessing="true">                     <match url="." ignoreCase="false" />                     <action type="Rewrite" url="index.php" />                 </rule>             </rules>         </rewrite>     </system.webServer>     </configuration>      Neither works. Help would be really appreciated.


title: P3 Profiler and Yoast SEO plugin

text: I have profiled my blog with the P3 Plugin and it pointed out that Yoast SEO slows down the site a bit. I then found out that the biggest performance penalty is paid when you "force rewrite" the titles[1], which I am doing. Now I do have quite an aggressive caching turned on with WP Super Cache. Does it still matter if I force-rewrite the titles then? Or in my case it doesn't change a thing since pages are pre-generated and served as static content? [1] http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast- performance-issues-does-it-do-any-good-now


title: How to show a users bio on a page

text: I'm fairly new to Wordpress. I have users that create profiles on my site and one of the sections is their bio. How can I take this information and display it on lets say a "users profile page". Thanks


title: How can meta boxes be added to "unknown" custom posts?

text: I'm running WP multi-site and I've created a plugin that adds meta boxes to my page and post.               add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'post', 'normal', 'high' );     add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'page', 'normal', 'high' );      The problem is that this isn't added for my custom post types. Adding another `add_meta_box` in my plugin isn't an option since it will only be relevant for this customer. Is there a way to get around this?


title: wordpress Static Page pagination

text: Im Using a post query in wordpress BUT the Pagination is not working, i don't know whats the problem BUT here is my code and i guess it's correct and no problem with it it shows that there is pages BUT when i Click on Next Page it refresh the page and don't show any new results just the same page. Im Using it on Static page to be The Home page of my theme               <?php          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $post_query = query_posts(array(         'post_type'      => 'cover', // You can add a custom post type if you like         'paged'          => $paged,         'posts_per_page' => 1     ));          ?>          <?php if ( have_posts() ) : ?>          <?php     while ( have_posts() ) : the_post();      ?>          <?php endwhile; ?>          ///Pagination Function in Functions.php     <?php my_pagination(); ?>          <?php else: ?>              No Results          <?php endif; ?>      **Pagination Function**               if ( ! function_exists( 'my_pagination' ) ) :         function my_pagination() {             global $wp_query;                  $big = 999999999; // need an unlikely integer                  echo paginate_links( array(                 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                 'format' => '?paged=%#%',                 'current' => max( 1, get_query_var('paged') ),                 'total' => $wp_query->max_num_pages             ) );         }     endif;


title: How to use update_post_meta inside wp_trash_post

text: I have some metadata on my post edit page that saves perfectly using the hook and function below:                   add_action('save_post', 'save_meta_data');         function save_meta_data($post_id){           if(isset($_POST['target_url'])) {             update_post_meta($post_id, 'target_url', $_POST['target_url']);           }         };      However, the same logic fails to save the meta data **before** a post is trashed which is what that hook is for (so I thought).                   add_action('wp_trash_post', 'save_meta_data');         function save_meta_data($post_id){           if(isset($_POST['target_url'])) {             update_post_meta($post_id, 'target_url', $_POST['target_url']);           }         };      It looks like in the second case that the whole $_POST array is empty, but I know the function is firing. Could some kind soul point out what am I doing wrong and what is the proper way to do this? Thanks, Ron


title: run script on publish

text: I am trying to run a script when a user publishes / updates a post. I am using the filter: wp_insert_post_data The problem I am having is the script is a php file outside of WordPress but on the same site (It works fine if i go direct to it) that just needs to be run. I tried to include the file using the filter but that stopped the post being updated for some reason. This is my current code:               function updateFeed( $data , $postarr) {        include 'jobsfeed.php';          return $data;     }          add_filter( 'wp_insert_post_data' , 'updateFeed' , '99', 2 );      Is there any way to be able to run this script? EDIT: It does seem teh file is being run but for some odd reason it is not outputting the custom field values. It is a simple php file with a loop using wp_query and it works fine when I go direct to it. - any ideas what it could be? EDIT: Figured out why teh custom post types were not working i had to change how the script retrievd an id. Now I have one final thing to fix for some reason when the script runs when a page is edited the xml output by the script is the previous save data. SO it means i have to press save twice to make my new edits appear. Is it getting the revisions or being triggered too early perhaps?


title: Why use while over if in single wordpress posts?

text: Why is `while()` used instead of say `if()` here:                       <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'content', 'single' ); ?>                  <?php _s_post_nav(); ?>                  <?php                 // If comments are open or we have at least one comment, load up the comment template                 if ( comments_open() || '0' != get_comments_number() ) :                     comments_template();                 endif;             ?>              <?php endwhile; // end of the loop. ?>      So I've seen this since forever and I've used it too because it's what Wordpress uses by default. However today I'm feeling a bit more curious than usual - why is while used instead of if ? Am I expecting to receive more than a single post in single post view ? https://github.com/Automattic/_s/blob/master/page.php#L18 https://github.com/Automattic/_s/blob/master/single.php#L13


title: Copying database tables to new database

text: am trying to migrate my old site to a new site, by only copying database tables. the reason doing this way is the old site is out of date with plugins etc and i have WooCommerce installed which i dont have translated only post/pages are in 2 languages. After iv copied over the tables when i went to pages/post it shows 0, yet WooCommerce shows all. iv ran through your WPML troubleshooting to fix any errors etc… this seems to work! but it now shows all pages but not under any lang! How can i can copy this correctly ?


title: How can I allow commas in tag names?

text: I want to allow commas in tag names? For example, `"hello, world"` or `"portland, or"` but Wordpress keeps separating them. I can do it from the categories page: ![image](http://img839.imageshack.us/img839/6869/picturepp.png) And it shows up fine. But anything added from the posts sidebar does not show up ok here: ![image](http://img52.imageshack.us/img52/4950/picture1oax.png) There is some discussion on it here: http://core.trac.wordpress.org/ticket/14691 but looks like it may not get solved, at least for a while. In the meantime, I'm looking for an easier solution than adding categories from the categories page. I've tried searching plugins, and didn't see any that would be helpful. There are a few that deal with replacing commas with other characters when displaying a list of categories, or tags, but I don't see any plugins that allow the user to replace the default separator. I don't care if I have to patch the core myself. Ideally I could write a plugin, but after looking through some of the code I can't figure out where this gets handled. Does anybody have a solution, or tips on what functions and javascript to start hacking? I'm not sure where to start looking in the code.


title: What's the default setting for including a <script> in a post

text: As we're evaluating whether we should build a Wordpress plugin and in that context I'm trying to figure out how Wordpress handles script tags in a post? What's the default setting? Thanks!


title: how woocommerce swatch color name when hovered or selected

text: I have the woocommerce plugin and the woocommerce swatches and photos extension that shows swatches instead of variations as a drop down. When hovering over the swatches and when a swatch is selected, I would like to be able to see the name of the color above the color table. enter link description here like the link above please and thank you for your help