title: How do I remove 'www.' from all internal links in self-hosted multisite?

text: This is my first WP administration (I have inherited this from another developer), so I would appreciate it if you could treat me as a newbie. I have a site with 40 or so pages and all the links on any page, image etc. are pointing at //www.mydomain.com, but I want them to point at //mydomain.com. The home page redirects clients correctly already (I believe this is a normal WP behaviour, as they think it is best practice and I am happy with that), but since the WP editor automatically creates links with the www subdomain, it's flicking back and forth between both as the user goes into the site. I don't want to do a re-direct with the .htaccess file as that creates overhead (and this is a work-around, not the desired behaviour), but there are far too many to change manually, and I suspect that any new ones would also be created with the www prefix anyway.. So how do I change this behaviour as well as changing the existing links?


title: Media handle sideload not working

text: I am using this media uploader wp snippet which downloads an image from my one site to other. It was working fine until yesterday but I checked this morning, it wasn't working.                           require_once(ABSPATH . 'wp-admin/includes/file.php');                 require_once(ABSPATH . 'wp-admin/includes/media.php');                 require_once(ABSPATH . 'wp-admin/includes/image.php');                      $media_img_url = 'http://abc123.com/wp-content/2013/08/qwerty.jpg';                 $tmp = download_url( $media_img_url );                 $post_id = 32454;                 $desc = 'The image is here';                 echo $tmp;  //Output: /tmp/qwerty.tmp          // Set variables for storage     // fix file filename for query strings     preg_match('/[^\?]+\. (jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $media_img_url, $matches);                   $file_array['name'] = basename($matches[0]);     $file_array['tmp_name'] = $tmp;          print_r($matches); //Output: Array()     echo $file_array['name'].                  //Output: Nothing          '<br>'.$file_array['tmp_name'];       //Output: /tmp/qwerty.tmp                           // If error storing temporarily, unlink                 if ( is_wp_error( $tmp ) ) {                     @unlink($file_array['tmp_name']);                     $file_array['tmp_name'] = '';                 }                      echo $file_array['name'];        //Output: Nothing                      // do the validation and storage stuff                 $id = media_handle_sideload( $file_array, $post_id, $desc );                     print_r($id); //Output: WP_Error Object ( [errors] => Array ( [upload_error] => Array ( [0] => File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini. ) ) [error_data] => Array ( ) )                       // If error storing permanently, unlink                 if ( is_wp_error($id) ) {                     @unlink($file_array['tmp_name']);                     return $id;                 }                    print_r($id);                  //Output: Nothing                  $src = wp_get_attachment_url( $id );                    print_r($src);                  //Output: Nothing      For debugging purposes, I echoed values at some points to know where it is not working. I have checked php.ini file many times,nothing is changed. Here are errors:               [Sun Sep 01 07:06:46 2013] [error] [client 213.236.00.15] (70014)End of file found: Error reading request entity data     [Sun Sep 01 07:11:09 2013] [error] [client 213.236.00.15] ModSecurity: Error reading request body: End of file found [hostname "abc123.com"] [uri "/wp-admin/admin-ajax.php"] [unique_id "UiNK-dBhnx0AAA3rD4cAAAAC"]      Frontend uploading Visual: ![image](http://i.stack.imgur.com/Q1mlF.jpg) Error when uploading images from frontend:               [Sun Sep 01 22:54:18 2013] [error] [client 213.236.00.15] ModSecurity: Input filter: Failed writing 8192 bytes to temporary file (rc 18446744073709551615). [hostname "abc123.com"] [uri "/wp-admin/async-upload.php"] [unique_id "UiQoCdBhnx0AACtXBFwAAAAA"]     [Sun Sep 01 22:54:55 2013] [error] [client 213.236.00.15] ModSecurity: Multipart parsing error: Multipart: writing to "/tmp/20130901-225455-UiQoL9Bhnx0AACtYB4gAAAAD-file-pwzC5a" failed [hostname "abc123.com"] [uri "/wp-admin/async-upload.php"] [unique_id "UiQoL9Bhnx0AACtYB4gAAAAD"]      These two lines are present redundantly with different timings in error log. Please anyone suggest how to resolve this? Thanks.


title: http error when uploading media files

text: I am having this same annoying issue many other have: When I am trying to upload images into Wordpress via the media uploader, it gives me an **http error**. Now I have tried the following, but nothing works:   * Multi-File uploader and the Simple browsers uploader   * Everything as stated in this post, including the 'memory fix', but still not. What is even more strange, and pointing to a server problem perhaps, is the following:   * I have a shared Linux hosting server account   * Inside the public_html folder, I have 4 different wordpress websites, where each website uses its own wordpress installation, **and they all have the same problem**   * I use different versions of wordpress - 3.5 and 3.6 between the different installations   * Even starnger, is that up until today, everything worked great, until I added another folder for a new wordpress installation.   * Each installation uses its own DB   * I do not use multi-site Can anyone please tell me why I keep getting this error? Thanks!


title: Loop in taxonomy for terms and post

text:
I'm having trouble getting this to work. I've created a custom taxonomy named article_subjects and am looping thru, displaying each term; but am trying to get the newest post for each term
         <?php             $args = array (                 'orderby'    => 'name',                 'order'      => 'ASC',                 'hide_empty' => true,                 'number' =>      '4'             );                  $terms = get_terms( 'article_subjects', $args );             foreach ( $terms as $term ) { ?>
                      <?php                      $postargs = array (                         'tax_query' => array (                             array (                                 'taxonomy' => 'article_subjects',                                 'field'    => 'name',                                 'terms'    => $term->slug,                                 'number'    => '1'                             )                         )                     );                     global $wp_query;                     $posts = new WP_Query($args);                          foreach ( $posts as $post ) { ?>
<?php echo $post->the_date ?>

<?php echo $post->the_title ?>

<?php echo $post->the_excerpt ?>
                     <?php } ?>
             <?php }         ?>


title: Can't enqueue scripts in the footer?

text: The WordPress codex says: > $in_footer > > (boolean) (optional) Normally scripts are placed in the section. If this > parameter is true the script is placed at the bottom of the . This requires > the theme to have the wp_footer() hook in the appropriate place. Note that > you have to enqueue your script before wp_head is run, even if it will be > placed in the footer. (New in WordPress 2.8) Default: false So I added `true` after each script's `src path`:               /**          * JavaScript          */              function my_scripts_method() {             wp_deregister_script( 'jquery' );             wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js', true );             wp_enqueue_script( 'jquery' );         }              add_action('wp_enqueue_scripts', 'my_scripts_method');              function media_queries_script() {             wp_register_script( 'mediaqueries', get_template_directory_uri() . '/js/css3-mediaqueries.js', true );             wp_enqueue_script( 'mediaqueries' );         }              add_action('wp_enqueue_scripts', 'media_queries_script');              function custom_script() {             wp_register_script( 'custom', get_template_directory_uri() . '/js/custom.js', true );             wp_enqueue_script( 'custom' );         }              add_action('wp_enqueue_scripts', 'custom_script');              function replace_script() {             wp_register_script( 'replace', get_template_directory_uri() . '/js/jquery.ba-replacetext.min.js', true );             wp_enqueue_script( 'replace' );         }              add_action('wp_enqueue_scripts', 'replace_script');      But the scripts are still being included in the header. Any suggestions to fix that?


title: Clean URLs for custom $_GET variables

text: I have a query var `show=othertemplate` that I can add to any URL to show any post, page or archive in Wordpress in a different template, like this: **mysite.com/[any URL]/?show=othertemplate**. I'd like for it to be accessible via clean URL, like **[any URL]/othertemplate** or **[any URL]/show/othertemplate**. I have tried achieving this by registering the query var with a query_vars filter and adding code like below to .htaccess, but Wordpress intervene and throws a 404. WP Debug Bar says that the query is looking for attachment=print.               RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_URI} !^/index\.php     RewriteRule ^(.*)/othertemplate/?$ /index.php/$1?view=othertemplate [L]      I have also tried using the Wordpress rewrite functions, but the same thing happens.               function st_myqueryvars($vars) {         $vars[] = 'show';         return $vars;     }          add_filter('query_vars', 'st_myqueryvars');          function st_myrewriterules( $wp_rewrite ) {       $newrules = array();       $new_rules['^(.*)/othertemplate/?$'] = 'index.php/$matches[1]?show=othertemplate';       $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;     }     add_filter('generate_rewrite_rules','st_myrewriterules');      Is there something I'm missing here? > **Update:** After flushing permalinks I see that this WP function rewrites > **/ _[any URL]_ /template** to **index.php?show=template** instead of > **index.php? _[the URL's corresponding query string]_ &show=template**. I > can't 'hard code' a query string like > post_type=$matches[1]&name=$matches[2]... into the rewrite rule because it > needs to work for any page/post/archive, which have different permalink > structures. How do I get around this?


I was in the midst deleting trash file and the internet connection is becoming really slow. When I clicked the Products tab in the wp-admin it says that: "Error establishing a database connection", although I did not change anything on the database. Also, there are times that the message: "Access to the webpage was denied" is appearing. I've restarted several times, and tried copying and pasting the link in different browsers, but its still appearing and I wonder why. Hope you guys can get me out of this stuff. I think I'm gonna broke down into pieces now. :(


title: Does it matter if two people are using the same Wordpress admin account?

text: Just wanna ask around if its possible for a person to disconnect from wp-admin when someone is already using the same account? Like for example two people are sharing only one wp-admin account. One will disconnect and the other one will not be disconnected. Is this possible?


title: Why is get_the_excerpt returning full content

text: I have my home page set to a static page with a custom page template. Here I want to show posts, but just the excerpts with a "Read more" link. I want to use the more tag, which is a part of wordpress so I hate the fact that this doesn't work! If I simplify the code that would be it:               while ( $q->have_posts() ) : $q->the_post();         $the_exc = get_the_excerpt();         echo $the_exc;     endwhile;      So how do I convince wordpress that on my home page I just want to show the excerpts (until the more tag). And this is like 75th time I'm dealing with this the_excerpt, the_content, issue. How do you guys do this?


title: Show posts with specific tag in a category page

text: I have a website which belongs to a magazine. I want do something like this: I want to create a link that refers to /category-slug/tag-slug. in that link, I want to show all posts with "specific tag" which are in "specific category". How can I do that?


title: Search box on single Post page should only search for posts

text:
<form role="search" method="get" class="search-form-for-post form-inline" action="<?php echo home_url('/'); ?>">
             <input type="search" value="<?php if (is_search()) { echo get_search_query(); } ?>" name="s" class="search-field form-control" placeholder="Enter Keyword">             <?php _e('Search for:', 'roots'); ?>                              <button type="submit" class="search-submit btn btn-default"><?php _e('SEARCH', 'roots'); ?></button>
     </form>      I have written above code in content-single.php It is searching pages also.I want to search only post when I am Searching from post


title: Custom field being erased after autosave

text:
Why wont the custom fields from this post type save? I have a custom post-type called Photos and a couple of meta boxes. Here is basically what I have in my functions.php               add_action('init', 'photo_register');          function photo_register() {              $labels = array(             'name' => _x('My Photos', 'post type general name'),             'singular_name' => _x('Photo', 'post type singular name'),             'add_new' => _x('Add New', 'photo item'),             'add_new_item' => __('Add New Photo'),             'edit_item' => __('Edit Photo'),             'new_item' => __('New Photo'),             'view_item' => __('View Photo'),             'search_items' => __('Search Photos'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => 4,             'taxonomies' => array('post_tag','category'),             'supports' => array('title','comments','trackbacks','revisions','custom-fields','page-attributes','thumbnail', 'excerpt', 'tags')           );               register_post_type( 'photo' , $args );         register_taxonomy("Photos", array("photo"), array("hierarchical" => true, "label" => "Photos", "singular_label" => "Photo", "rewrite" => true));               }          add_action("admin_init", "admin_init");     add_action('save_post', 'save_details');          function admin_init(){ // add_meta_box( $id, $title, $callback, $page, $context, $priority );        add_meta_box("media", "Media Type", "media", "photo", "side", "high");       add_meta_box("map_meta", "Mapping Info", "map_meta", "photo", "normal", "high");       add_meta_box("photo_meta", "Add a photograph", "photo_meta", "photo", "normal", "high");     }          function media(){       global $post;       $custom = get_post_custom($post->ID);       $film = $custom["film"][0];       $camera = $custom["camera"][0];            ?>       Camera:       <input name="camera" value="<?php echo $camera; ?>" />              Film:       <input name="film" value="<?php echo $film; ?>" />            <?php     }          function photo_meta(){       global $post;       $custom = get_post_custom($post->ID);       $single_photo = $custom["single_photo"][0];       ?>

             <input id="single_photo" name="single_photo" value="<?php echo $single_photo; ?>" />

         <input type="button" value="Upload" name="upload" id="upload_image_button" />

            <?php     }               function map_meta() {       global $post;       $custom = get_post_custom($post->ID);       $latitude = $custom["latitude"][0];       $longitude = $custom["longitude"][0];            ?>

Latitude:
       <input id="latitude"  name="latitude" value="<?php echo $latitude; ?>"></input>

Longitude:
       <input id="longitude" name="longitude" value="<?php echo $longitude; ?>" ></input>

             <?php }            function save_details(){       global $post;       update_post_meta($post->ID, "single_photo", $_POST["single_photo"]);       update_post_meta($post->ID, "latitude", $_POST["latitude"]);       update_post_meta($post->ID, "longitude", $_POST["longitude"]);       update_post_meta($post->ID, "camera", $_POST["camera"]);       update_post_meta($post->ID, "film", $_POST["film"]);          }      I had it working for a while but now it will not save the fields and a refresh wipes everything. Can anyone see what the problem is? Any suggestions on how to find the bug? Basically anything you can think to improve this would be much appreciated, especially if I can get it to work! ## EDIT I figured out that they do save but if I remain on a post long enough for an autosave to run, then try to navigate away I get the message : > The page is asking you to confirm that you want to leave - data you have > entered may not be saved. I click leave then when I return to the post everything is erased. What is going on here?


title: Overriding The Loop with filter or hook

text: I'm trying to replace the `$wp_query` object for a specific category, without having to deal with creating a new template and creating a new `WP_Query` object there. My aim is to change the data available to The Loop from the default for that request to a custom query.               add_filter( 'pre_get_posts', 'custom_wpquery' );          function custom_wpquery( $query ){     global $wp_query;        if (is_category(121)) {                  if ($wp_query === $query) {                        $query = new WP_Query('page_id=146');                        $query->set('page_id', 146);                  }        }       return $query;     };      That doesn't seem to affect The Loop at all, what am I doing wrong?


title: Exclude post from home page and archives, but still public

text: Can a post be hidden from home page, archive view, category lists etc. and viewable only if you have a direct link to it? The blog doesn't have registered readers and is open to public so that would be a mean of hiding some posts from public view without using the password protection.


title: Admin filter/error if post title is too long

text: Is there a filter that will throw an error if the posts creator enters a post title that is too long? I am looking to throw an error like: "The title you've entered is more than 30 characters. Please change the title and try again." Preferably this might be a banner alert like standard errors or at least something noticeable. In addition the post will not be saved until the title is of the correct length. I know there is the wp_insert_post_data filter where you can modify the title before it is saved, but I don't want to do something like truncating as it might not make sense to the end user. This is something I would like the post writer to change.


title: make a excerpt on data from a meta box?

text:
I have made a custom post type called `news` that has meta boxes. I would like to print the data from the metabox as a excerpt. How can I do that? This is the code that I use that prints the data :               <?php $loop = new WP_Query( array( 'post_type' => 'news', 'posts_per_page' => 10, 'post_parent' => 0 ) ); ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>     <?php the_excerpt(); ?>
<?php echo get_post_meta( $post->ID, 'twpb_news_textdate', true ); ?>

<?php echo get_post_meta( $post->ID, 'twpb_news_rub', true ); ?>

<?php echo get_post_meta( $post->ID, 'twpb_news_textnews', true ); ?>
          <?php endwhile; ?>


title: post thumbnail: increase dimension if smaller than... Possible?

text: I need thumbnails of minimum width: 400px. I would like that if the user uploads an image that is, say, 380px wide, Wordpress creates a 400px-wide version. Is that possible?


title: upgrade from WPMU 2.9.2 to WP 3.2.1

text: I am running WPMU 2.9.2 and want to update to WP 3.2.1. As I understand it, WP 3 took in WPMU. I imagine that involved some big changes to the implementation of WPMU. What steps do I need to take to perform the upgrade? Thank you. Pat


title: multisite registration: check existing subdomains while typing

text: I wish to ask how to build a real time control while a user attempt to register his website in a wordpress multisite installation. The control should check if the subdomain already exists while the user is typing it into the input field. This control will involve a simple jquery function, executed while typing, that check all the existing subdomain in the wordpress database table. Any suggestion would be appreciated. Thank you very much.


title: How can I include author (their archive page) in search results?

text: How can I include author archive pages in the default search results? For example if I have an author name Billy Joe and I type his name into the search box a link to his author archive would display.


title: Reset Loop get_posts();

text:
I add too single.php menu:
     <?php     $all_posts = get_posts(array(          ));          // this variable will contain all the posts in a associative array     // with three levels, for every year, month and posts.          $ordered_posts = array();          foreach ($all_posts as $single) {     $year  = mysql2date('Y', $single->post_date);     $month = mysql2date('F', $single->post_date);     // specifies the position of the current post     $ordered_posts[$year][$month][] = $single;     }          // iterates the years     foreach ($ordered_posts as $year => $months) { ?>
         <?php echo $year ?>
         <?php foreach ($months as $month => $posts ) { // iterates the moths ?>         <?php foreach ($posts as $single ) { // iterates the posts ?>
                 <a href="<?php echo get_permalink($single->ID);// echo   '#post-'.$single->ID;?>"><?php echo get_the_title($single->ID); ?>

         <?php } // ends foreach $posts ?>              <?php } // ends foreach for $months ?>

 <?php     } // ends foreach for $ordered_posts     ?>
      After this code a got loop to print single post:
                   <?php /* The loop */ ?>         <?php rewind_posts(); ?>         <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'content', get_post_format() ); ?>             <?php twentythirteen_post_nav(); ?>             <?php comments_template(); ?>              <?php endwhile; ?>
      but on every single page, I have the latest post. Pleas help me.


title: Copy url from post_content to custom field

text: I'm new to MySQL so I don't know if this is even possible. I would like to copy a url that's in post_content to a custom field. The url is variable and it looks like this:               [audio:http://www.website.com/folder/file.mp3]      Is it possible to copy just the url (http://www.website.com/folder/file.mp3) to a custom field? I've tried different things but as I don't always understand how to query MySQL I've had no luck. Thanks!


title: Add class to WordPress admin bar?

text: How can I to add a wrapper class to the WordPress admin bar? I would like to center the contents to the same width as my theme.


title: Using wp_mail with attachments but no attachments received

text: Ok I give up. Been looking at multiple examples including this one. I get the email no problem but there are no attachments. Am I missing the content/type of file type? All the examples I've seen uses only text/html as the content type. Here's what I have (added upon Stephen's request)               if( isset( $_POST['to'] ) && isset( $_POST['from'] ) ) {     global $wpdb;          $to = $_POST['to'];     $from = $_POST['from'];      $name = get_bloginfo('name');     $attachment = $_POST['file'];     $headers  = 'MIME-Version: 1.0' . "\r\n";     $headers .= 'Content-type: multipart/mixed; charset=iso-8859-1' . "\r\n";          $headers .= 'From: ' . $name . ' <' . $from . '>' . "\r\n";        $subject = 'Send to Kindle';     $msg = 'Yay! Your book has arrived';          $mail_attachment = array( $attachment );     wp_mail($to, $subject, $msg, $headers, $mail_attachment);     echo 'Email sent';     } else {     echo 'Email not sent';     }


title: Simple Multilanguage Switcher

text: Firstly i have been install wp with different languange with indonesian languange as default, i have plan, want to translate with other languange, How to simple translate switch, but keep Indonesian as default. with .po file thanks for the help ...


title: How does the ternary operator work in the wordpress loop post?

text: Okay so I kind of understand that ternary operators work like                 condition ? TRUE : FALSE      However I'm looking a simple loop to get my posts that I have               <?php if (have_posts()) :     while(have_posts()): the_post();         the_content();         endwhile;     endif;      ?>      The question I have is where is the ? in this syntax. Why is the `:` used when according to the                  condition ? TRUE : FALSE      Whatever comes after the semicolon is when that statement `(like have_posts())` is FALSE?


title: Removing the base "Author" or changing it to something else. is it possible?

text: Is it possible to remove the AUTHOR base? Is it possible change it to postedBy so that the urls is site.com/postedBy/joe And finally, is it possible to remove a custom taxonomy base from the url so that a url like site.com/people/joe can become site.com/joe


title: Restricting access to content

text: I'm developing a functionality to let only customers and doctors have access to exam results. But i'm not so sure about the strenght of my code in securing view only to those authorised. I've gotten so far as to create the 'exam' post type to handle the information and added the metabox to save doctor and patient info in every exam (doctor and patient are also custom roles for users, with capabilities similar to subscribers). then i've created this function to check if the user trying to view content is entitled to it:               /*      * Checks if user is logged in and has access to that specific exam      */     function rm_userauth_check() {         global $current_user;           get_currentuserinfo();           $doctor = get_post_custom_values('doctor');           $patient = get_post_custom_values('patient');           $loggeduser = $current_user->user_login;           $nicename = $current_user->display_name;           $mainrole = $current_user->roles;            if ($current_user->data !== null) {                if ($mainrole[0] == 'doctor' && $loggeduser == $doctor[0]) {               return true; // this user is a doctor and is assigned to this exam           } elseif ($mainrole[0] == 'patient' && $loggeduser == $patient[0]) {               return true; // this user is a patient and is assigned to this exam           } else {               return false; // this user is not assigned to this exam           }       } else {           return false; // user is not logged in       }      and now i'm calling it on my single-exam.php file as                       <?php if (function_exists('rm_userauth_check')) : ?>                  <?php if (rm_userauth_check()) : ?>                  <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                      <?php get_template_part( 'content', 'single' ); ?>                  <?php endwhile; // end of the loop. ?>                <?php else : ?>                            <?php wp_redirect( home_url() ); exit; ?>                <?php endif; ?>         <?php endif; ?>      How does it look to you? Am i going the right way here or should i try another method?


title: Get excerpt using get_the_excerpt outside a loop

text: I have a code that call `get_the_title()` and it works, but `get_the_excerpt()` return empty. How can i make it work? This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the part i want to change:               if (is_singular('post')) {       if (has_excerpt($post->ID)) {         echo "\t<meta property='og:description' content='".esc_attr(strip_tags(get_the_excerpt($post->ID)))."' />\n";       }else{         echo "\t<meta property='og:description' content='". [?] ."' />\n";       }     }else{       echo "\t<meta property='og:description' content='".get_bloginfo('description')."' />\n";     }      Here, `has_excerpt` always fail, and `get_the_excerpt($post->ID)` don't work anymore (deprecated). So, how can i display the excerpt there? ps: I'm using "Advanced Excerpt" plugin as well


title: Comments screen in backend, how to disable visual editor when replying to a comment

text:
I'm almost done to create my project with WP and all the steps taken have brought me almost to the finish line. The following recent answers I had were able to help me customizing the comments area: Comments screen in backend, how to disable Quick Edit | Edit | History | Spam | for non admins Comments screen in backend, how to disable email address of commenter for non admins Now I need to disable the visual editor when a contributor/author replies to any comment received as I'd like not to let them easily add links to their reply. I've opened up the source and the visual editor is called here but I don't know exactly where:

     <link rel='stylesheet' id='editor-buttons-css'  href='http://www.dogsheaven.net/wp-includes/css/editor.min.css' type='text/css' media='all' />
     <textarea class="wp-editor-area" rows="20" cols="40" name="replycontent" id="replycontent">     </textarea>
      I've no idea about which filter should I add, any help? Thanks!


title: Can multiple custom post types share a custom taxonomy?

text: I'm considering rebuilding a drupal site in wordpress and am still wrapping my head around the differences between the systems - particularly cck/fields and custom content types and the different ways to use taxonomy. I would like to know if two custom content types can share one custom taxonomy. In drupal I can limit the posting of a particular content type to a group of users and then that posting can have taxonomy that is only shared with one or more other content types (but not all types). Leaving the user aspect out which appears possible with role scoper, can you do this with wordpress? I've only seen custom content type with custom taxonomy but no way to share a given taxonomy between 2 or more custom content types without recreating it in two places or enabling it globally through categories/tags... Thanks, -Chad.


title: get_template_part vs action hooks in themes

text:
It seems to me both of these afford the opportunity for the end user to modify a theme without actually editing the themes files (via child themes). My question is, is one method preferred over the other. For example take a theme I am workig on now. I am trying to decide whether to go with template parts of hooks.               <?php get_template_part('before_sitecontainer' ); ?>     <div id="sitecontainer" class="sitecontainer" <?php //closed in footer ?>>          <?php get_template_part( 'before_topcontainer' ); ?>
              <?php get_template_part( 'before_topedge_navigation' ); ?>         <?php get_template_part( 'topedge_navigation' ); ?>              <?php get_template_part( 'before_site_header' ); ?>         <?php get_template_part( 'site_header' ); ?>              <?php get_template_part( 'before_second_navigation' ); ?>         <?php get_template_part( 'second_navigation' ); ?>              <?php get_template_part( 'after_second_navigation' ); ?>
     <?php get_template_part( 'after_topcontainer' ); ?>      The above allows the user of the theme to replace any section of existing code by simply creating an appropiately named file in their child theme folder as well as adding new code before/after each pre existing section by the same method - the before/after template part files don't exist in the parent theme at all and are there simply to allow them to insert code - and this method does not require they understand hooks/filters to accomplish this. I could of course achieve the same using hooks and filters. Is there an advantage to using hooks/filters instead? Bearing in mind the target audience that will be using this is decidely _not_ code savvy. I can give them relatively basic instruction they can follow to use the template method but will almost surely confuse the devil out of them with hooks. Or are there situations where one would be better than the other within the same theme?


title: Add Default Wordpress Formatting To Data From External SQL Tables?

text: I have a number of external SQL tables that have data in exactly the way I want and I would like to use them to populate various wordpress posts with shortcodes. The problem is that I don't understand how wordpress 'filters' text in get_content() so that the proper   and are added. IOW: I have a proper WP Post and I display the contents on a page it auto- magically includes   and tags. If I copy that text to my external table and then pull that field into the same WP post using               $result = $wpdb->get_col( "SELECT my_text FROM my_songs WHERE id = '" . $song_id . "'" );         ...the results has none of the `<br>` or `<p>`s unless I explicitly add them to the text. How can I take $result above and 'format' it so that it matches the same text from a WP Post using `get_content()` ?


I'm developing a theme which uses the NHP Theme Options Framework to add some theme options. Naturally, the theme options framework creates a single row in the database to store the theme's options into. If I create a child theme of the parent, it shares the same theme options as the parent, which leads me to my question: Should a child theme share the same theme options row as the parent, or should it have it's own options row? Is there a reason why one would be better than the other? If they are shared and you switched between the two themes, your options would be intact. This can be great if that was the intended behavior. On the other hand, you might go to great lengths to customize the child theme thinking it's independent, switch back to the parent and find your changes overridden. I'm having a hard time choosing one over the other. What are your thoughts?


title: Displaying images from external RSS feeds?

text: Is there any way to show an image for RSS feeds in my WordPress page? Currently the default WordPress RSS feeds will only show the text of feeds from other sites. How can I make my site show a thumbnail image of RSS feeds of the other sites?


title: Any amazing Wordpress MultiSite sites?

text: I'm just curious, because I love wordpress.


title: Wordpress shopping cart that supports 2 tier product variation options

text: I need a wordpress shopping cart that will produce 2 tier product variations. For example if you pick 'option 1' for a product, sub-options 'x' 'y' 'z' will be revealed and if you pick 'option 2', sub-options 'a' 'b' 'c' will be revealed. Im OK with a commercial cart, but I haven't found any that specifically list this functionality in their documentation and since they are commercial, I can't access their respective support forums to find out more with out first purchasing the cart. Is there a cart that supports this kind of functionality?


title: How do I access the menus produced by Dashboard > Appearance > Menus

text:
A continuation to this question: Replacing WordPress menu functionality with a plugin Since I really rarely work with WordPress (I've done a lot of work with phpBB, myBB, Concrete5, and custom PHP scripts - but my WordPress experience is limited to one or two simple sites) I feel that I might get an answer quicker here than spending 3 hours reading through the documentation. I'm creating a plugin to replace the WordPress menu with my own. So far here is the code for this plugin (it's all in a single PHP file):               add_action('init', 'DEMenu::init');     class DEMenu {              public static function init() {             $DEMenu = new DEMenu();             load_plugin_textdomain ('de-menu', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');             /* Load CSS with wp_enqueue_style() */                  // If in admin page, then load admin page stuff             if (is_admin()) {                 add_action('admin_menu', 'DEMenu::admin');             }                // If not on admin page ...             else {                 // Load plugin core - doesn't require a hook                 $DEMenu->core();             }              }              public static function admin() {             add_options_page('DE Menu Options', 'DE Menu', 'manage_options', 'de-menu', 'DEMenu::options');     //      add_option('de_menu_maintenance', 'off');         }              public static function options() {             if (!current_user_can('manage_options'))  {                 wp_die( __('You do not have sufficient permissions to access this page.') );             }             echo '
';             echo '
Here is where the form would go if I actually had options.
';             echo '
';         }              public static function core() {                  /* Add support for various themes */             add_filter('wp_nav_menu', 'DEMenu::display');                  /* If I need to add more actions/filters they will go here... I may enqueue CSS here, too */              }              public static function display() {             print "Let's see if this displays. I'll add some text to ctrl+F for later";         }          }      This is mostly the culmination of various bits of advice from the WordPress documentation, plugin development tutorials, and basic OOP practices. Now I'm tasked with drawing the menu from the Dashboard > Appearance > Menus area. How can I access this menu object (as an array or other accessible data type) so that I can work with it? And I do realize it seems silly to completely override the `wp_nav_menu()` output if I'm just going to be using the same menu, however I can think of no other way to accomplish what I want. EDIT - I have been reading through `wp-includes/nav-menu-template.php` to learn how `wp_nav_menu()` gets the list of menu items, as well as how it displays it. I have been trying to essentially emulate the method used by this function only with slight variations to add in the multi-column structure. Here is what I have so far:               public static function core() {              /* Add support for varoius themes */         add_filter('wp_nav_menu', 'DEMenu::display', 1);              /* If I need to add more actions/filters they will go here... I may enqueue CSS here, too */          }              public static function display( $args ) {             /* The following is blatantly ripped from nav-menu-template.php */                      // *****************************************************************                 /* Excluded for ease of reading - this is an exact copy of nav-menu-template.php */                 // *****************************************************************                  // Here we can invoke our custom walker without editing the theme             $args->walker = 'DEMenu_Walker';                      $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args );                 unset($sorted_menu_items);                      // *****************************************************************                 /* Excluded for ease of reading - this is an exact copy of nav-menu-template.php */                 // *****************************************************************          //          $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );     //       //          if ( $args->echo )     //                  echo $nav_menu;     //          else     //                  return $nav_menu;                  // Rather than checking if we should echo the output, just return it.             // This is a filter, so the output will be echo'd by the calling function             return $nav_menu;         }      Then later (outside of the DEMenu class):               class DEMenu_Walker Extends Walker_Nav_Menu {              function __construct() {             die("We made it to the constructor!");         }          }      However I am getting the following error:               Warning: Attempt to assign property of non-object in /home/coupon/public_html/wp-content/plugins/DE-menu/index.php on line 146      This line number is referring to:               $args->walker = 'DEMenu_Walker';      Perhaps there is a far more reasonable solution that I have over-looked, however from what I can tell I need a custom walker class (along with private variables for keeping track of how many items have been displayed and how many items should be displayed per column) and this is the only way to use a custom walker class without editing the theme. However if I'm to use the solution that I'm currently working on then I need to understand why the `$args` variables is a non-object when `wp_nav_menu()` clearly has the following line of code near the very beginning of the function:               $args = (object) $args;      ANOTHER EDIT - I solved the non-object problem. When `wp_nav_menu()` calls the filter it is calling it like so:               $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );      I failed to realize that this meant it was passing two arguments. I modified the display function like so:               public static function display( $nav_menu, $args ){      And of course modified the `add_filter()` call like so:               add_filter( 'wp_nav_menu', 'DEMenu::display', 1, 2 );      Although now I'm getting all sorts of fun new errors.               Fatal error: Using $this when not in object context in /home/coupon/public_html/wp-includes/class-wp-walker.php on line 185      Mind you I have made absolutely no modifications to WordPress core, so I don't understand why there's an error in `class-wp-walker.php`... I also don't understand why this error is just now showing up. Any ideas? FINAL EDIT - With help from http://stackoverflow.com/questions/6862887/replacing-wordpress- core-functionality-with-a-plugin I have finally realized that I can use the `wp_nav_menu_args` filter to pass my own walker class without copying the entirety of the `wp_nav_menu()` function. I will be using this solution (solving this problem), although as mentioned above - I am having a new problem where my walker class is causing its parent class to throw a fatal error. I will make a new question for that since it's an issue with the Walker class and not with accessing menu items or passing a custom walker. * * * **Task:** I need each sub-menu (second level or lower) to be divided into 5 columns (either 5 separate `<ul>` elements or `<div>` elements wrapped around certain `<li>` elements).


title: WordPress Export/Import for custom options.php values?

text: I've just discovered the WordPress export/import routine under the tools menu. However, upon testing it for the first time, several values stored in my wp_options table did not transfer over. Is there a way to include those values when exporting/importing a site?


title: get_categories returns an array with one category

text: I'm running a query on a custom plugin to display all categories and put them into a dropdown (the select parts are outside the loop) which looks like this:               <?php     $ember_categories = get_categories();     foreach($ember_categories as $ember_category) {         echo '<option value="' . $ember_category->cat_ID . '">' . $ember_category->name . '</option>';     }     ?>      For some reason though, it's only returning my default category (Uncategorized) - even though there are six more added to the system (including one I added afterwards, just as a curiosity). I'm wondering whether I'm doing something glaringly wrong?


title: Exporting Data from WordPress into a flat table

text: I need to be able to export the data within WordPress so that each `object` is contained in a single row, like a flat table. Imagine each post type as it's own database table, containing columns that represent all of the metadata. Right now, I'm having the hardest time trying extract all of the `key / value` pair metadata. I've tried `get_posts` and then looping over each post and extracting the metadata with `get_post_meta` ... but this just produces a bunch of convoluted array data. What would be the recommended way of doing this?


title: TinyMCE editor - new lines not rendered on front end

text:
I've been working with a plugin making various tweaks and adding additional functionality. It uses custom post type to create a page with an associated download. In the admin area which allows you to create these new downloads, there is a box which allows you to add/edit a description for the download. This serves as the body content for the rendered page. However, the admin page only had a standard for this which was created by the following code;                   public function display_sdm_description_meta_box($post) {  // Description metabox     _e('Add a description for this download item.', 'sdm_lang');     echo '

';          $old_description = get_post_meta($post->ID, 'sdm_description', true);     ?>     <textarea id="sdm_description" name="sdm_description" style="width:60%;height:100px;"><?php echo $old_description; ?></textarea>     <?php     wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');      } I needed this to give the typical WP editor functionality so that the end user can create the page / body content much the same as on a normal page or post. As a result I was given the following code via another question I posted here on SO.               $old_description = get_post_meta($post->ID, 'sdm_description', true);      $editor_id = 'sdm_description';     $settings = array( 'media_buttons' => false );      wp_editor( $old_description , $editor_id, $settings ); So I now have;               public function display_sdm_description_meta_box($post) {  // Description metabox         _e('Add a description for this download item.', 'sdm_lang');         echo '

';              $old_description = get_post_meta($post->ID, 'sdm_description', true);              //adds TinyMCE capabilities         $editor_id = 'sdm_description';         $settings = array( 'media_buttons' => false );         wp_editor( $old_description , $editor_id, $settings );              ?>                  <?php         wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');     }      This render the tinyMCE editor in the admin section. However, if I hit enter to add a new line to the content this is only rendered as ` ` on the front end. Multiple 'enters' just result in more spaces, but never a new line or the equivalent of `<br/>` Why isnt the content output as expected? How can it be fixed? Thanks in advance! _-_ - _-_ EXTRA INFO If i click the 'Tools' > 'Source' button on the TinyMCE editor I get a pop up windows showing the content I've created as being: `<p>This is a test</p><p>Another line of testing!!!</p>` However on the front-end [eg the website] the source code shows as: `This is a test Another line of testing!!!` If I go into the DB, I can see that the data is stored literally like this:               This is a test                                Another line of testing!!!


title: Find sidebar.php in WP 3.9.2

text: I have tried to find sidebar.php in WP but I cant find it. Can anyone help me? I would like to remove achieve and META. I have been looking for this php file sidebar for a very long time now. Your sincerely


title: Admin encoding problem

text: My breadcrumbs plugin is taking blog name as starting point: blog name > category title > post title The problem is if I set the blog name in cyrillic characters it is desappearing as soon as "save" button is pressed. So in admin it looks like an empty field. On the site the question characters are shown where blog name should be. Check here k-gayduk.ru Any help appreciated.


title: Where can I access my custom page template?

text: I understand that to create a new page template, all I have to do is create my custom template (in this case, `page-custom.php`) file, and save it in `wp- content/themes/mytheme/`. However, where can I access this newly created template file? I want to edit it now... but it does not show up the page editor's Page Attributes options as an available template to use. This what I see on the page editor: ![enter image description here](http://i.stack.imgur.com/g3rG2.png) My newly created `page-custom` template isn't there. How can I make it appear as an option under Templates?


title: Media Library not displaying edited images when accessed through 'Add Media' button

text: I am experiencing an issue with edited photos not displaying in the media library when trying to add media to a post, they do however, display when you view the media library from the sidebar link. Here is what I see when I click on 'Media' from the WordPress dashboard sidebar.... ![enter image description here](http://i.stack.imgur.com/j2XEX.png) You can see the image that I have cropped using the WordPress image editing funcitonality and saved. If you then go to create a new post and click on the 'Add Media' button to insert an image into the post, you see this..... ![enter image description here](http://i.stack.imgur.com/zGZRw.png) Which is the original image, before editing. I have tried this on several different installs on several different server and all exhibit the same behaviour. Am I doing something wrong or have I discovered an issue that needs addressing?


title: Confusion about Site url and directory

text: I have installed my wordpress in root/mysubfolder so my standard path is example1.com/mysubfolder (example1.com is the domain i have registered the webspace with) Now i want the wordpress installation to work with example2.com (registered another domain) Therefore i have set the redirect for example2.com to the folder mysubfolder in my webspace admin area what do i have to change to get this to work? i have tried this in the wp-config.php file:               define('WP_HOME','http:example2.com');     define('WP_SITEURL','http:example2.com');      it works for the wp-admin and the homesite.. but if i click on a post the path is example2.com/post1 ..which doesn't work


title: Theme only supports one menu?

text: I would like to use the main menu but also have a menu in the footer for things like about, career, etc. Am I ~~fubared~~ foobared or can I do this?


title: Set thumbnail from URL, by grabbing image in functions.php

text: So I've written a whole bunch of functions, which are used to display Vine videos. I then have a shortcode which outputs the code. The last thing I have to do is set the post thumbnail. I want to be able to do this automatically when the post is published. On a Vine page, in the `<head>`, they have a piece of code which specifies an .jpg image of the video. I have been able to successfully grab this and upload it to the server in the uploads directory. However, the problem is that I can't seem to be able to set that image that's been grabbed + uploaded as the post thumbnail. Either, the same attachment is given to each post (an image I manually uploaded a while ago) or it doesn't set at all. Here's my code:               function vineThumb($id) {         $vine = file_get_contents("http://vine.co/v/{$id}");         preg_match('~<\s*meta\s+property="(twitter:image)"\s+content="([^"]*)~i', $vine, $matches);              // Add Featured Image to Post         $image_url  = $matches[2]; // Define the image URL here         $upload_dir = wp_upload_dir(); // Set upload folder         $image_data = file_get_contents($image_url); // Get image data         $filename   = basename($image_url); // Create image file name              // Check folder permission and define file location         if( wp_mkdir_p( $upload_dir['path'] ) ) {             $file = $upload_dir['path'] . '/' . $filename;         } else {             $file = $upload_dir['basedir'] . '/' . $filename;         }              // Create the image  file on the server         file_put_contents( $file, $image_data );              /* code works up to here. Image of the just-published Vine appears in the uploads directory. I now need this image to be set as the post-thumbnail. */              $attachments = get_posts(array(             'numberposts' => '1',              'post_parent' => $post->ID,              'post_type' => 'attachment',              'post_mime_type' => 'image',              'order' => 'ASC'         ));              $attachment = $attachments[0]->ID;              set_post_thumbnail($post->ID, $attachment);             /* here the same attachment ID is given - if I return $attachment; it will give the same ID, so when the code runs it just uploads the same attachment to each post. */     }         Hope I've been clear enough - it's quite difficult to explain :) thanks for any help :)


title: WordPress settings API error when checkbox unchecked

text: I am trying to creating some custom options for a template I am developing but I am getting an error when the checkbox (Line 130) is unchecked: > Warning: Illegal string offset 'show_admin_dev' in E:\composite- > cms\WordPress-Settings-Sandbox-master\lib\admin\pages\dev-page.php on line > 11 This is the line that seems to be throwing the error:               if ( $options['show_admin_dev'] == 1 )      The entire code can be found on GitHub.


title: Linking Javascript in functions.php file

text: Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct syntax using the `wp_enqueue_script` function.               <script src="../assets/components/plugins/ajaxify/script.min.js?v=v1.9.6&sv=v0.0.1"></script>          <script>var App = {};</script>          <script data-id="App.Scripts">     App.Scripts = {              /* CORE scripts always load first; */         core: [             '../assets/components/library/jquery/jquery.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/library/modernizr/modernizr.js?v=v1.9.6&sv=v0.0.1'         ],              /* PLUGINS_DEPENDENCY always load after CORE but before PLUGINS; */         plugins_dependency: [             '../assets/components/library/bootstrap/js/bootstrap.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/library/jquery/jquery-migrate.min.js?v=v1.9.6&sv=v0.0.1'         ],              /* PLUGINS always load after CORE and PLUGINS_DEPENDENCY, but before the BUNDLE / initialization scripts; */         plugins: [             '../assets/components/plugins/nicescroll/jquery.nicescroll.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/breakpoints/breakpoints.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/ajaxify/davis.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/ajaxify/jquery.lazyjaxdavis.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/preload/pace/pace.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/owl-carousel/owl.carousel.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/common/forms/elements/bootstrap-select/assets/lib/js/bootstrap-select.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/less-js/less.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/modules/admin/charts/flot/assets/lib/excanvas.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/browser/ie/ie.prototype.polyfill.js?v=v1.9.6&sv=v0.0.1'         ],              /* The initialization scripts always load last and are automatically and dynamically loaded when AJAX navigation is enabled; */         bundle: [             '../assets/components/plugins/ajaxify/ajaxify.init.js?v=v1.9.6',              '../assets/components/core/js/preload.pace.init.js?v=v1.9.6',              '../assets/components/modules/admin/content/assets/news-featured-2.init.js?v=v1.9.6',              '../assets/components/modules/admin/content/assets/news-featured-1.init.js?v=v1.9.6',              '../assets/components/modules/admin/content/assets/news-featured-3.init.js?v=v1.9.6',              '../assets/components/core/js/sidebar.main.init.js?v=v1.9.6',              '../assets/components/core/js/sidebar.collapse.init.js?v=v1.9.6',              '../assets/components/common/forms/elements/bootstrap-select/assets/custom/js/bootstrap-select.init.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/core/js/sidebar.kis.init.js?v=v1.9.6',              '../assets/components/core/js/core.init.js?v=v1.9.6',              '../assets/components/core/js/animations.init.js?v=v1.9.6'         ]          };     </script>          <script>     $script(App.Scripts.core, 'core');          $script.ready(['core'], function(){         $script(App.Scripts.plugins_dependency, 'plugins_dependency');     });     $script.ready(['core', 'plugins_dependency'], function(){         $script(App.Scripts.plugins, 'plugins');     });     $script.ready(['core', 'plugins_dependency', 'plugins'], function(){         $script(App.Scripts.bundle, 'bundle');     });     </script>         <script>if (/*@cc_on!@*/false && document.documentMode === 10) { document.documentElement.className+=' ie ie10'; }</script>


title: Manipulating wp_head content

text: I'd like to know if it is possible for me to manipulate the output of wp_head()? Right now I'm using the Yoast SEO plugin to add some social tags into my posts (og:*). Now this site is an remake of an older umbraco based blog, and the permalink structure is different, so the old urls are 301 to the new ones, but addthis requires the old url to keep the right count, so we have a custom field that provides the "addthis:url" when required... Unfortunately facebook & twitter do not use that url, but they use the pages "og:url" meta tag, that the plugin provides (which points to the new url), and seems that it can not be manipulated in the post. My idea is that before the wp_head is printed out, I would basically do an search-and-replace to change that "og:url" to correct one, but I have not found a way to do that... So what I'm asking is that is my idea correct and how to do it, or is there a better/official way to fix this solution?


title: This CSS Stuffing Works, But Is This A Good Practice?

text: I am trying to include a dynamic css in my plugin, I have been searching anywhere but doesn't find any case that is similar to what I do. And what I use to do it is by adding a css file directly into the end of my plugin php file after the closing php tag `?>` without adding any other stuffs like calling wp head etc. Here is the example of the code I put directly into the end of my plugin's file:               <style type="text/css">             .innertrow { background-color: <?php get_options('css_value');?>}          </style>      Is that a good practice?


title: How to create TEMPORARY Download links in a wordpress POST?

text: I'm creating a WordPress blog with some members-only page. In those members- only posts I have my own tutorial download links which i have uploaded for FREE. Problem is I want them to stop sharing the download link for the tutorials, instead of that I want to give them links which will only works once OR It will only work when it is accessed from mydomain.com .. Can anyone help me? any idea would be much appriciated. -Regards


title: Remove Ability for Administrators to Delete Administrators

text: I've been studying roles and capabilities and have worked with and worked up a bunch of awesome code for creating unique capabilities and roles. I have created a "Master Editor" role to maintain users with almost every capability... However, edit_users & delete_users obviously allows for an editor to CUD users, including the existing administrators... At the moment I'm to new at coding to be confident editing users.php but I have to be close to the solution:               if ( ! current_user_can( 'delete_users' ) )      // or is trying to delete an admin's $userids      wp_die(__('You can’t delete users.')); // or administrators          $update = 'del';     $delete_count = 0;          foreach ( $userids as $id ) {         if ( ! current_user_can( 'delete_user', $id ) )             wp_die(__( 'You can’t delete that user.' ) );              if ( $id == $current_user->ID ) {             $update = 'err_admin_del';             continue;         }         switch ( $_REQUEST['delete_option'] ) {         case 'delete':             wp_delete_user( $id );             break;         case 'reassign':             wp_delete_user( $id, $_REQUEST['reassign_user'] );             break;         }         ++$delete_count;     }      I can't figure out how to check that the $userids in question are an administrators user ID. Because if I can I could add that to the die... Am I on the right track? Thanks in advance.


title: Wrapping my head around add_filter

text: this is a very general question, which I have really researched. Maybe I'm just being stupid, but I can't quite get when I can use a filter. After some messing around earlier, it seems I can take any function in the core files, pass this as the filter name, and the second argument I can replace this with my own function in the functions.php or plugin file. Is that correct? Can I literally modify anything doing this? I've been trying to alter some fields on the user profile page, which sucks because some can be altered and some can't as the PHP and HTML doesn't come from a function or class I can work with - it seems certain things can only be changed by hacking around the core files, which I'm not about to do! So, in summary, can anyone please give me a very short and sweet explanation as to why and when I'd use an action or a filter. This has become I hurdle I wan't to get over! Many thanks ,Dan. Update: Sample code?               function get_stylesheet_directory() {         $stylesheet = get_stylesheet();         $theme_root = get_theme_root( $stylesheet );         $stylesheet_dir = "$theme_root/$stylesheet";              return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );     }


title: use query string in URL to display content on the page

text: I'd like to say something on my wordpress page, based on what page the person got there from. I can set up the link to that page to be www.website.com/page?parameter=myparameter, but is there a way I can access that parameter so that I can have it show on the page, somewhere in my content? Thanks! Update: With your help and some googling, I put together a shortcode that returns the value of any url parameter. here it is:               //THIS IS A CUSTOM SHORTCODE TO DISPLAY A PARAMETER FROM THE URL     function URLParam( $atts ) {           extract( shortcode_atts( array(             'param' => 'param',         ), $atts ) );         return $_GET[$param];       }     add_shortcode('URLParam', 'URLParam');       I use the shortcode like this: [URLParam param='trip_type'] to get the trip_type from my url. YAY! Next step: work on some conditional logic....


title: How do i know which action / filters are called when i call get_option()

text: I need to know which action / filters are called when i do a `get_option()` call, how can i do that?


title: wp_mail recipient array not sending?

text: I am using wp_mail to send an email to multiple recipients. my mail function looks like this:               wp_mail($group_emails, 'my subject', 'my message', $headers);      `$group_emails` is an array of email address's and gets outputed like this:               $group_emails = Array ( [0] => ceri@test.com [1] => craigj@test.com [2] => danyob@test.com [3] => geoffh@test.com [4] => ianc@test.com [5] => mark.butcher@test.com [6] => mickh@test.com [7] => mike@test.com [8] => stephd@test.com [9] => stuartj@test.com )      For some reason the email does not get sent to the above emails? If i remove the multiple recipients and just put a single email address, it works fine! Any suggestions?


title: buddypress: how do i make the group description excerpt shorter?

text:
I set up a theme in buddypress and i want to have a teaser section for my groups on there. It works fine but i have a problem to shorten the group description... I'm using it like this:
<a href="<?php bp_group_permalink() ?>"><?php bp_group_name() ?>

<?php bp_group_description_excerpt() ?>
      If there´s a very long group-description it crashes my layout. Is it possible (like in wordpress) to make the excerpt shorter (with a function or something)? Like "maximum of 20 letters", or something like that? Thanks.


title: Wordpress: Loop Help

text:
I was working on this site this morning and I ran into a bit of an issue with my static page. I have a "featured" post section and I use:
         <img src="<?php echo get_bloginfo('template_directory'); ?>/images/house.jpg" alt"Buy Me" />
          <?php query_posts(array ('tag'=> 'featured' )); ?>         <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"> <?php the_title(); ?>

<?php the_time('F jS, Y') ?> by <?php the_author() ?>
         <?php endwhile; ?>

      The above works great, however, the page content is where I am running into an issue. I have a content section that is pulling in the "pages" actual content, and I use:
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                     <?php the_content(); ?>

              <?php endwhile; ?>              <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>              <?php else : ?>
Not Found
              <?php endif; ?>
      When I refresh the page, both of the sections are now displaying the featured post, and not the the page content. Does anyone have a clue to why this is happening?


title: Simple child theme modification but links are broken

text: I have created a simple child theme to modify the Minimal theme by Elegant Themes. The child theme loads with the changes I have made, but the links to pages in the header are all messed up. Rather than the page links I have selected appearing in the header, links to all categories appear in addition to links to these pages. Even if the only modification I make is as follows:               @import url("../Minimal/style.css");          a {         text-decoration: underline !important;     }      The links at the top are still messed up and the category links are improperly displayed in addition to the page links, even though I am not making any other changes. (But the underline does display.) What is causing this issue? EDIT: Clarified that category links are what is being display incorrectly.


title: Create WP account from an external email form submission?

text:
I have a single email field form on a static, 1 page html website which upon submitting, I would like it to pass the entered email to a WordPress install to use as an email for a new account. The html website and the wordpress website are on different domains. Can WordPress handle this without a custom plugin? I have the html of my form from the static website below:               <form action="signup.php" id="contact_form" method="post" onsubmit="return validateForm();">

Just enter your email to start. Easy, with spam-free goodness.
     <input type="text" name="email" id="email" value="Enter your e-mail" class="requiredField email" onblur="if(this.value == '') { this.value = 'Enter your e-mail'; }" onfocus="if(this.value == 'Enter your e-mail') { this.value = ''; }" />
Add additional details later, no credit cards required!

<input id="submitted" class="input-submit" type="submit" value="Sign Up" name="submit" />

          </form>      Upon Submission, I have a javascript function which validates the email entered:                     The form action sets some variables and shoots me an email of the submitted email address:               <?php     $email_to = "accounts@xxxxxxxxxx.com";     $emailSubject = 'User Account Submission from xxxxxxxxxxx';     $email = $_POST["email"];     $text = "Email: $email
";     header("Location:http://xxxxxxxxxxx.com/signup.html");     mail($email_to, $emailSubject, $text);     ?>      How would I instead: 1) send this to WP so that WP can use the email to create an account 2) have wp setup a temp password 3) and then email the new account+pass to the user? I'm still a beginner when it comes to customizing WordPress and am not sure the best way to go about sending WP the form? Any help or insight on the proper places to look would be appreciated!


title: preg_match() not working with post content

text:
I'm new to Wordpress, and I wrote the following function:               function find_my_image() {     if(is_single()) {              if (preg_match('#()#', $content, $result)){                  $content .= '
Image has been found
';              }         else{                  $content .= '
Sorry, no image here!
';              }               }     echo $content;          }     add_filter('the_content', 'find_my_image');      Basically, I just want to find out if my post has a image in it and display proper message. Currently, I'm always getting the false result, so I'm just wondering what am I doing wrong.


title: How to get search results in the backend admin on a custom post type?

text: I have a custom post type books and have many meta boxes for it...etc But in the backend, I am not able to search anything. For example I try to search the custom post type id in the search field, it comes back with no results. How can I add different search items into the search query?


title: Retrieve post tags from from main wp_query

text: I'm running a custom WP_Query and find the following SQL running as part of it.               SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag') AND tr.object_id IN (381, 383, 389, 395) ORDER BY t.name ASC      Now within the loop I'm using `wp_get_object_terms( $post->ID, 'post_tag' );` to retrieve post tags. This results in additional SQL queries for each post to retrieve post tags. Something I believe shouldn't be necessary when the post tags were fetched when the WP_Query initial ran. WordPress is smart enough not to do this with post meta, as any number of calls to `get_post_meta` within the loop never results in additional SQL queries. How can I retrieve the post tags and possibly the categories from the original WP_Query and avoid extra SQL queries.?


title: Filter orders by product in admin

text: I'm setting up Woocommerce store for a client who is selling tickets to multiple different live shows. On the night of a show, the box office manager needs to be able to view only orders that contain one specific product (the show). Does anyone know of a plugin that would allow a store manager to either view all orders that contain a specific product, or download a csv of those orders (ideally both)? Barring that, if anyone has had to do something similar and has any insights on adding custom filters to the order screen, I would really appreciate your input! Thank you.


title: Custom metabox with App Store / Google Play links

text: I've got a issue when trying to setup our app portfolio. (have a look at our portfolio page) Whats going on: I created a custom post type with 'apps'. Every post I'm going to create is a project we worked on. In this post there might be 3 properties: 1) App store link 2) Google Play store link \---- optional: ---- 3) Intern app (no link) Meanwhile, in our template this will be displayed: Is there a store link? If yes, make this image (http://www.dreamix-studio.com/images/ios_button.png) a link: Else: Create this image (http://www.dreamix- studio.com/images/ios_inactive_button.png). This also goes for the Google Store link. How do I create this? And how do I create this in our template?


title: Restrict post edit/delete based on user ID and custom field

text: I've been able to prevent deletion and editing of posts based on user ID and page ID however, I need to restrict access to editing and deleting based on a custom field. Not sure how to go about doing this. **Current working code for restricting user ID from editing/deleting based on page ID:**               function restrict_post_deletion($post_ID){         $user = get_current_user_id();         $restricted_users = array(1,2,3,4,5,6,25,54,19);         $restricted_pages = array(2,21,52,64);              if(in_array($user, $restricted_users) && in_array($post_ID, $restricted_pages)){         do_action('admin_page_access_denied');         wp_die( __('You cannot modify or delete this entry.') );         }     }     add_action('edit_post', 'restrict_post_deletion', 10, 1);     add_action('before_edit_post', 'restrict_post_deletion', 10, 1);     add_action('wp_trash_post', 'restrict_post_deletion', 10, 1);     add_action('before_delete_post', 'restrict_post_deletion', 10, 1);      So we'll say custom field is: $customstatus $customstatus is already defined within the post through a dropdown with two options 'available' and 'protected'. In this example, restricted_pages and post_ID are no longer relevant since I'm not restricting based on a custom field. I would like the restrict_post_deletion function to prevent editing/deleting of posts based on the user ID AND $customstatus == 'protected'. **The following is not working:**               function restrict_post_deletion($post_ID){             $user = get_current_user_id();             $customstatus = get_option('wp_customstatus');             $restricted_users = array(1,2,3,4,5,6,25,54,19);                  if(in_array($user, $restricted_users) && $customstatus == 'protected'){             do_action('admin_page_access_denied');             wp_die( __('You cannot modify or delete this entry.') );             }         }         add_action('edit_post', 'restrict_post_deletion', 10, 1);         add_action('before_edit_post', 'restrict_post_deletion', 10, 1);         add_action('wp_trash_post', 'restrict_post_deletion', 10, 1);         add_action('before_delete_post', 'restrict_post_deletion', 10, 1);      Where am I going wrong? Some help would be greatly appreciated.


title: Loop with array of posts using 'Advanced Custom Fields' plugin

text:
i'm getting in trouble using Advanced Custom Fields (acf) plugin. I'm using the 'Post Object' using more less this code:               <?php          /*     *  View array data (for debugging)     */          var_dump( get_field('post_objects') );          /*     *  Loop through post objects (assuming this is a multi-select field) ( setup postdata )     *  Using this method, you can use all the normal WP functions as the $post object is temporarily initialized within the loop     *  Read more: http://codex.wordpress.org/Template_Tags/get_posts#Reset_after_Postlists_with_offset     */          $post_objects = get_field('post_objects');          if( $post_objects ): ?>
         <?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>             <?php setup_postdata($post); ?>
                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                 Post Object Custom Field: <?php the_field('field_name'); ?>
         <?php endforeach; ?>
         <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>     <?php endif;      that is the example code from ACF site. Problem start when I try to paginate the posts in $post_objects variable because it's an array of posts but is not possible to apply the               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>      beautiful wp loop and I don't now how to paginate a foreach loop. Any suggestion? Francesco


title: Is there a way to get N number of WYSIWYG editors in a custom post type?

text: Is there way to have multiple WYSIWYG editors for a custom post type? For example, if I had a 2 column layout I wanted to have one editor for one column and another editor for the other.


title: Change Genesis <title> Tag from Page Template

text: I have made a page template for a Genesis theme in which I want to change the `<title>` tag but I can't find any API reference or example to do this. Does anyone have any idea how to do this?


title: In Settings>>General I am missing some fields

text: I am new to Wordpress and downloaded the 3.5.1 version from my hosting provider. I want to add www in front of my domain and I read from many sources how to do this. Go to settings then general and change it there. Thats fine except my screen in General looks nothing like the instructions I have been following It does not have a place to change the Site or Wordpress URL. Am I missing something ![enter image description here](http://i.stack.imgur.com/ZukYv.png)


title: Transfer of wordpress site from one domain and server to another domain and server

text: I have moved a wordpress site from one domain and server to another domain and server. Everything looks fine except all the links within the site are still pointing to the previous domain. Please let me know what went wrong with the transfer. I'll really be thankful for the kind response and help.


title: Add exception to WP Mobile Detector

text: In the function `websitez_detect_mobile_device` in `functions.php` of WP Mobile Detector there is the detection of a mobile device (smartphone). Now I want that my Samsung Galaxy Tab (GT-P5100) is not treated as a smart phone. It should not redirect the user and the user should get the desktop version. The user agent according to whatsmyuseragent.com is: > Mozilla/5.0 (Linux; U; Android 4.0.3;de-de;GT-P5100 Build/IML74K) > AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 How can I add an exception for this device? Can I use this code?               case (preg_match('/GT-P5100/i',$user_agent)); //Android         $mobile_browser = false;         $mobile_browser_type = "0"; //Tablet     break;      Or is there a better way?


title: upgrade plugin in wordpress

text: I am using wordpress on my live server which only uses sftp using an ssh key. I want to install and upgrade plugins, but it appears that you are required to enter your ftp login to install the plugins. Is there a way to install and upgrade plugins by manually uploading the files instead of having wordpress handle the entire process?


title: Make a category my homepage

text: I've been trying every way, reading every post, to find out how to get my homepage to show category only. In my case, I will only like to show "travel" I have tried another way is to set it as a menu first, however, the page does not show up as my home page, rather all my posts instead of posts only from the Travel menu unless I click on it Is there a way around this, as in step by step will be great!


title: Wordpress Permalinks 404 bug with "next" button

text: I have changed wordpress to use permalinks for post names. `/%postname%/` so that they are in the form `wordpress.com/sample-post`. The permalinks work great but it messes up the "next" and "previous" buttons. The default permalink structure works great, but whenever I change the permalinks to any other form, the next button link gets changed to `wordpress.com/page/2`. which doesn't exist... how do I get the buttons to link to the correct place? It appears this is a bug on wordpresses side, but I can't find any answers to this problem directly.


title: Are mu-plugins plugins still deployed via wordpress.org/plugins?

text: I'm getting ready to publish my first plugin. I've decided to put it in mu- plugin, because if you removed it, it would break other code dependent on it. (It's a developer tool for logging variables to a text file.) So, do can I submit this to wp.o? Or do they only accept plugins that go into the plugins directory?


title: Secondary Query Is Breaking Main Query

text:
I registered a Custom Post type called "quote" and I am trying to show a single random quote on every page of my Wordpress site. I'm pulling out a single quote with the following code:               $args = array( 'post_type' => 'quote', 'posts_per_page' => 1, 'orderby' => 'rand' );     $posts = get_posts( $args );          //The code between here and the next comment doesn't really matter.  I can remove it     //and the problem will still exist.  As soon as I make the get_posts() call above     // I get the problem        if (sizeof($posts) > 0) {         echo '
"'.$posts[0]->post_content.'"
';         $author = trim(get_field("author", $posts[0]->ID));         if (!empty($author)) {echo '
- '.$author.'
';}      }       //End block      wp_reset_postdata();      This works and I'm able to show a single random quote. (I'm using the advanced custom fields plugin which adds the get_field method in the code above.) However, my main loop content gets corrupted. Instead of showing the main loop content on the page, my quote is repeated a second time in it's place. This is the code I'm using for my main loop.                <?php while(have_posts()) : the_post(); ?>          <div class="post" id="post-<?php the_ID(); ?>">
               <?php the_content(); ?>

       <?php endwhile; ?>       If I remove the code that displays the quote, my main loop content gets restored. I thought calling `wp_reset_postdata()` was the key to using a secondary loop with the main loop, but it doesn't seem to help in this case. Can anyone point me in the right direction?


title: Multiple instances of TinyMCE are removing <p> tag

text:
I'm using the following code in functions.php to add a TinyMCE box on custom field textareas inside the Editor:               add_action('admin_print_footer_scripts','FT_TinymceCustom',99);     function FT_TinymceCustom()     {     ?>          <?php      } However, on any box I add this to, it seems to cause a bug that deletes paragraph tags. So if I enter this in the custom TinyMCE textarea (source view):
test
p>test
      After saving, this is what shows in the box:               p>test test
      This only occured after the latest 3.9 update, which forced me to modify my JS code above to make it work.


title: How to execute a shortcode?

text:
I have a WordPress option that stores some data, like:
Header

Paragraph
     [shortcodesomething/]     [shortcode]Contents[/shortcode]      I'm displaying this option's value using `echo get_option('my_option'));`. Of course the shortcodes doesn't work, and I'm wondering how to force them to do what they are supposed to do? `echo do_shortcode(get_option('my_option'));` doesn't work either (I know this is an absolutely wrong approach, but I don't know any other way of displaying them).


title: delete uploaded file

text: I have a function wp_handle_upload() for uploads files.               $file = $_FILES['attachment_icon-' . $i];     $upload = wp_handle_upload($file, array('test_form' => false));      what is a function for delete a uploaded file?


title: Adding action to save_post, post needs to be saved twice for function to work

text: I have written the following function which copies all post terms from the "tribe_events_cat" taxonomy to the "categoria" taxonomy when the post is saved. There is a bug where in order for the terms to be copied, I need to click "update" twice (i.e. save the post twice). I believe this happens because when I call `get_the_terms`, the post has not been saved yet. Is there any way around that, so that `get_the_terms` gets the terms from the newly updated post?                  function bam_save_event_cat( $post_id ) {             $taxonomy = 'categoria';                  $tribe_cats = get_the_terms( $post_id, 'tribe_events_cat');                  foreach($tribe_cats as $tribe_cat) {                 if( empty($tribe_cat->name) ) continue;                 $catname = $tribe_cat->name;                 $cats[] = $catname;             }             wp_set_object_terms( $post_id, $cats, $taxonomy );         }              function bam_save_event($post_id) {             if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                 return;                  if ( !current_user_can( 'edit_post', $post_id ) )                 return;                  if(get_post_type( $post_id ) == 'tribe_events' ) {                 remove_action( 'save_post', 'bam_save_event' );                 wp_update_post( array( 'ID' => $post_id ) );                 add_action( 'save_post', 'bam_save_event' );                      bam_save_event_cat( $post_id );             }         }              add_action( 'save_post', 'bam_save_event' );


title: Change content off every sixth element

text:
I would like to create custom post query where i will list all my posts in the list. Then the tricky bit is to add different content to sixth element off that list. So something like this
custom post 1

custom post 2

custom post 3

custom post 4

custom post 5

<the_content>

custom post 6

custom post 7
          ok here is what it did:
              <?php $my_query = new WP_Query( array(              'post_type' => 'people',              'posts_per_page' => 10,              'order' => 'DESC',              'paged'=> $paged         ) );?>                                  <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>                                  <?php if (  $my_query->current_post == 5 ) { ?>
I'm odd one
                              <?php  } else {?>
<?php the_title(); ?>
                              <?php } ?>                                                 <?php endwhile; ?>                             <?php wp_reset_query();?>
      I hope that make sense, Thank you very much.


title: How To Use Custom Tax of a Post Type

text: I've defined a custom post type. I've defined a custom taxonomy for this custom post type. I've populated the custom taxonomy. How do I make the list of custom taxonomy values show up in the admin edit page of the custom post type? So I can assign one or more custom taxonomy values to the custom post type post? Thanks


title: Post order by custom fields

text: <?php query_posts( 'cat=16'); ?>             <?php if ( have_posts() )              while ( have_posts() ) : the_post(); ?>                                     <?php print_custom_field('time'); ?>                            <?php the_title(); ?>          <?php endwhile;?>      this is my query I want the post is order by custom field 'time' in ASC


title: Worried I have a funky .htaccess for WP site in light of strange search engine behavior

text: My friend started a new (non-commercial) blog 5+ months ago, but Google + Bing are acting like we're telling it to not be indexed. I don't mean it ranks poorly. I mean it doesn't rank **at all.** I checked Google Webmaster Tools. No malware/bad rep. **Google + Bing crawl it regularly, but index no pages.** I initially suspected robots.txt, but GWT is not complaining about it. And so now I turn to .htaccess. Does this look strange to you? Feedburner having two entries? Deny from all and Allow from all in the same entry? I'm pretty ignorant about .htaccess and Apache, but just the inconsistency seems funny.               # temp redirect wordpress content feeds to feedburner     <IfModule mod_rewrite.c>     RewriteEngine on     RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]     RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]     RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/anonymousblog  [R=302,NC,L]     </IfModule>          # temp redirect wordpress comment feeds to feedburner     <IfModule mod_rewrite.c>     RewriteEngine on     RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]     RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]     RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$    http://feeds.feedburner.com/anonymous_comments [R=302,NC,L]     </IfModule>          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*          <Limit GET POST>     order deny,allow     deny from all     allow from all     </Limit>     <Limit PUT DELETE>     order deny,allow     deny from all     </Limit>          php_value memory_limit 32M


title: How long does plugin review usually take?

text: WordPress says that plugins are manually reviewed within a "vaguely defined amount of time". What's the experience? How long does this take, on average?


title: How do you keep the default WYSIWYG active when using a custom template?

text:
I've created a custom template for my "About Us" page because it need more options than what the static "page.php" file had to offer. However the content that i enter into my "About Us" page from the default WYSIWYG editor on the back end doesn't appear on the new template obviously because i'm not calling in that template part (if that's even the right term for it). Just to be clear when i create a custom template and need to call in a custom Field Group i'm using               <?php get_template_part( 'content', 'content_area' ); ?>      However i will state that on this template page i'm not using a loop in this particular php file, is that not ok. Do loops need to be part of all php pages? Maybe i should start there. Here's my code               /*     Template Name: About Us     */          include(TEMPLATEPATH."/header-internal.php");

            some content goes here

          <?php get_template_part( 'content', 'content_area' ); ?>
                               <?php      $args = array(       ' post_type' => 'content_area'      );      $the_query = new WP_Query( $args );      ?>           <?php if( $the_query->have_posts() ) : while( $the_query->have_posts() :      $the_query->have_posts(); ) ?>
<?php the_field( 'header' ); ?>

<?php the_field( 'content_area' ); ?>
           <?php endwhile; endif; ?>


I want the page mysite.com/product to be accessed with the URL > mysite.com/product/productname instead of > mysite.com/product?name=productname I am trying to achieve this with the code in the plugins main file:                add_rewrite_rule('^(product)/([^/]*)/?', 'product?name=$matches[1]','top');      but I am getting the error: > Fatal error: Call to a member function add_rule() on a non-object in > /location/wp-includes/rewrite.php on line 21 Any suggestions?


title: add_rewrite_rule regex issue

text: I am trying to add the following function into my functions.php through the WordPress editor but every time I try it says error 403 Forbidden - Access to this resource on the server is denied!               function my_custom_rewrites(){         add_rewrite_rule(         '^/?database/([0-9]+)/?([a-zA-Z0-9_-]*)/?([a-zA-Z0-9_-]*).html',         'index.php?image=$matches[1]&comms=$matches[2]&commz=$matches[3]',         'top' );     }      I know the following line is the issue as if I remove it completely, it successfully updates functions.php:                   '^/?database/([0-9]+)/?([a-zA-Z0-9_-]*)/?([a-zA-Z0-9_-]*).html',      I have tried removing certain characters without success. I have previously used this regex string in .htaccess files


title: How to increase image by URL upload limitation

text: System info - wordpress multisite installation - Version 3.9.1 with following system info - RAM 69,8/128M • SQL 142 • PHPv 5.3.28 Hi Support Team, I am using a multisite installation with a geotheme Theme and setup a central image storage by using this code within wp-config.php: define( 'UPLOADS', 'wp- content/'.'images' ); Now a limitation problem ocur after reaching round about 1.000 images by Url uploaded (/wp-content/_images/icons/...example.png) into my media library. I need these icons to be used as category icons for the geotheme setup. I am still able to add and save Urls but after checking this the icon is not saved. It seems there is a limitation on importing images by URL´s in Media Library. Now I Need help to find out why I am not able to add more images by Url-Upload into the media library. Is there a code available to increase this limitation? Alex P.S. I asked also the theme developer, but without any positive results. They say I have to import the images directly into the media library, but do not want this because I want to use the indirect Image urls (/wp- content/_images/icons/...example.png) for the other sub-sites too without beeing forced to add these images too into the sub-site media library. AND I want to make sure that later on after migration and changing of the main domain, all images will be available too.


title: Function to load correct CSS for Template not working

text: I have three templates I want to be able to use (Index Page, Main Template, and Default). I was able to add a "if/else" statement into a function to get the correct CSS file to load depending on which template was being used between two templates (Index and Default). However, when I try to use "elseif" so I can add in another option for Main Template, it doesn't work. Instead the page that uses Main Template loads the Index Page CSS. This is the code in question:                   if ( is_page() && ! is_page_template( 'page-templates/index_page.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style1', get_template_directory_uri().'/layouts/index_page.css' );         } elseif ( is_page() && ! is_page_template( 'page-templates/main_template.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style2', get_template_directory_uri().'/layouts/main_template.css' );         } else {             wp_enqueue_style( 'authorLuncheon-layout-style3', get_template_directory_uri().'/layouts/content-sidebar.css' );         }      Here's the whole function:               function authorluncheon_scripts() {         wp_enqueue_style( 'authorluncheon-style', get_stylesheet_uri() );              if ( is_page() && ! is_page_template('page-templates/index_page.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style1', get_template_directory_uri().'/layouts/index_page.css' );         } elseif ( is_page() && ! is_page_template( 'page-templates/main_template.php' ) ) {             wp_enqueue_style( 'authorLuncheon-layout-style2', get_template_directory_uri().'/layouts/main_template.css' );         } else {             wp_enqueue_style( 'authorLuncheon-layout-style3', get_template_directory_uri().'/layouts/content-sidebar.css' );         }              wp_enqueue_script( 'authorluncheon-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );              wp_enqueue_script( 'authorluncheon-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20130115', true );              if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {             wp_enqueue_script( 'comment-reply' );         }     }     add_action( 'wp_enqueue_scripts', 'authorluncheon_scripts' );


title: ACF checkbox array is returning numbers, not labels

text:
I am using Advanced Custom Fields and the add-on Repeater to create a field in the admin through which a user can select multiple icons. Each icon has an associated label, and I'm trying to return the results of the checked icons in a `foreach` loop. Here's my code:               <?php     // icons     foreach (get_sub_field('nav_widget_platforms') as $label => $value) {         echo '
'.$label.'
';     }     ?>      So for example, if the checkbox `cloud : eCommerce` is selected, the `$value` should be `cloud`, and the `$label` should be `eCommerce`. The problem is that `$label` is returning numbers, not labels, so that the page is displaying `0`, `1`, etc. depending on which order it is in the array. I'm not sure what I'm doing wrong here, or how to troubleshoot it.


title: Trouble creating custom sanitization function when uploading video files

text: I'm trying to create a Theme Customizer control in Wordpress that will allow the user to upload an MP4 and WEBM video, and in doing so I need to create a sanitization option to verify the file type. I'm having some trouble and can still upload any type of file... Here's what I'm doing:               function customizer_header_image( $wp_customize ) {            // Header Background Video (MP4)       $wp_customize->add_setting( 'header_video_mp4', array(         'default'             => '',         'sanitize_callback'   => 'check_header_video'       ) );            $wp_customize->add_control(         new WP_Customize_Upload_Control( $wp_customize, 'header_video_mp4_control', array(           'label'             => __( 'Header Video (MP4)', 'rainier' ),           'section'           => 'header_image',           'settings'          => 'header_video_mp4',         ) )       );          }          // Register the customize functions     add_action( 'customize_register', 'customizer_header_image' );          // Custom sanitize function for header video uploads     function check_header_video($file){       return validate_file($file, array('webm', 'mp4'));     }      As you can see I pass the control's `'sanitize_callback'` parameter to my `check_header_video`, and in there you can see in that function that it runs the file against a native Wordpress function `validate_file`, with accepted file types. Not having much luck. Does anyone know what I'm doing wrong here?