Changing user of post by changing 'post_author' field in 'wp_posts' table not taking effect. Where is the real post author info kept?

I just imported my entries from my blog into a freshly installed Wordpress. I created a new user..e.g. "bob" (bob has an ID=2 in the wp_users table). I want the author of the new posts that I've imported to be "bob". So I thought that I change the post_author of a post to 2! However, when I went to view the post in the blog, the author was still the old author. I found the work around for this...you can actually change the author by using the bulk post editing function. After I did this, the posts in the blog had their author as "bob". But, when I went to the wp_posts table, the post_author field did not change. I looked at all the wp_ tables and can't see where a post's author is indicated. The only place that I found was the wp_posts table...but changing the post_author doesn't see to take any effect when you look at the blog. So, the mystery is...where is the real author id of a post kept? **UPDATE** OK...I found out that there were some posts that were duplicated _except_ for their 'post_status'. There are some weird statuses such as 'auto-save' and 'inherit'. I unfortunately didn't see the post_status column and changed the 'post_author' of a post with the 'inherit' status. So mystery solved... The new mystery, i.e. what the different 'post_status' values are is answered here.


No paragraphs for a part of text in editor

How can I set, if possible, WordPress editor to not insert paragraphs for a part of post entry? I want to use divs inside the post, but W3C Validator gives invalid response.


Custom post type permalinks

I have a custom post type called "number" and I would like to achieve URL's for it's "posts" to be the following http://website.com/post-name instead of http://website.com/number/post-name. I tried to set the 'rewrite' parameter in register_post_type to: `'rewrite' => array( 'slug' => '', 'with_front' => false )`, but it didn't worked. Even if I saved my permalinks settings to flush it. (I have my permalinks set to Day and name - /%year%/%monthnum%/%day%/%postname%/) Do you have any ideas how to achieve it? I am doing a transfer of one website to WP and I would like to keep the current URL structure, so it will be safe for Google as well. Thank you in advance for any tips.


Jigoshop - change the order in which products show up in a grid

Using the http://jigoshop.com/ plugin, is it possible to change the order in which the products are displayed in the different grids. I'm not quite sure how it decides the order but is it possible to change it to sort it via menu order? This is the page I'm working on - http://www.roadsafetyforchildren.co.uk/product-category/roadmaster-sets/ (I've yet to check browser compatibility with the site - I'm using Chrome)


Expire a post with meta_value after two weeks

I am trying to use the below code to query for some posts and then change a meta_value in order to "expire" it after two weeks time. I can't get this to work and it's difficult to test since I can only run it hourly. Anyone see what might be wrong?                   // This function run hourly to expire posts that have been live for two weeks or more     function expire_job_listing() {         $args = array (             'post_type' => 'job_listing',             'posts_per_page' => '-1',             'post_status' => 'publish',             'listing_status' => 'active',             'date_query' => array(                 array(                     'column' => 'post_date_gmt',                     'after' => '60 days ago',                 ),             ),         );         $the_query = new WP_Query( $args );         if ( $the_query->have_posts() ) {             while ( $the_query->have_posts() ) {             $the_query->the_post();                 date_default_timezone_set('America/Los_Angeles');                 $now = time();                 $jobstart = get_post_time('U', true);                 $expirein = 1209600; //1209600 <-Two weeks in seconds                 if (($jobstart + $expirein) <= $now) { //if timestamp of publish date + the length of time before expiration is in the past, it's expired                     update_post_meta($post->ID, 'listing_status', 'inactive');                     $untilexp = 0;                     update_post_meta($post->ID, 'until_expires', $untilexp);                 } else { //else the post isn't expired yet                     $untilexp = (($jobstart + $expirein) - $now);                     update_post_meta($post->ID, 'until_expires', $untilexp);                 }             }         }         wp_reset_postdata();     }          //Set the expire_job_listing function to run hourly         if (!wp_next_scheduled( 'expire_event' )) {             wp_schedule_event(time(), 'hourly', 'expire_event');         }     add_action( 'expire_event', 'expire_job_listing' );


Is there an if statement that can determine if a post in the loop is the last post?

For example, inside the loop could i do something like this               if lastpost {      }     else {     }


Tag subscription option in wordpress. How?

I love stackexchange's tag subscription feature. Now i'm receiving email notifications only for the topics i'm interested in. I would like to have this feature in my wordpress site. Is there any good tag subscription plugin available?. If there is no plugin available why not WA experts create one and submit it in the WPSE Plugin Repository?


Add product category to post_class

In the content-product.php template, this is the section of the code I am working with (line 43):               <li <?php post_class( $classes ); ?>>      I need to find a way to include categories as part of the $classes variable, because as of now, it is not echoing the categories into the class, and I need this to do a sort on the products. Any ideas?


Selling Downloadable Products

I have a few questions that I've been trying to find the answer to for a few weeks to no avail. I am starting a business where I sell downloadable files I've created. They'll be in .zip format. Once I find a theme I like, and do any design work to the theme, etc, I'm good to go. My problems are as follows:   1. I can only upload 2megabyte files to wordpress, thought the products I'll be selling are about 12megabytes each. So can I get around this? (been looking and trying for days now, I'm not sure whether it's my hosting site that's blocking higher uploads because I've tried every tweak) Or can I host the file for sale on another site and have it accessible through a purchase on wordpress that way? Does that make sense? I know it's a complicated question.    2. See, my intention was to upload these 5, 12 megabyte files to my media library, and then link to them and set up the paypal, etc--using what I found on this page: http://www.heatherporter.com/get-more-customers/adding-paypal-to-wordpress-sell-ebook/ But this only works if you're using a small file.    3. So I guess my question is, are there any e-commerce plugins that allow you to host the file for sale on another site, or something like that, yet are still downloadable if someone were to buy them on my wordpress site?   4. Once I've picked a theme I like and I decide to buy it for $50 bucks or whatever they charge, can I then purchase an e-commerce plugin separately and have it work with the theme I bought? I realize I've asked 4 tough questions. I appreciate your help so much. It's been a goal of mine for 2 years now to get this website up and running. I've spent the last 2 years designing what I'm going to be selling and now the only thing standing in the way of me starting my business is my ignorance at how to accomplish it. THere's so much information it's overwhelming. Thank you, Kelsey Todd


Is there a way to avoid 404 pages in Wordpress?

On my site, people can link to non-existing posts, which is fine because that's the whole structure on my site... The problem is that you get 404 errors, which is not good for SEO. Is there a way in Wordpress to avoid 404 pages? So if a post not exists, that you can do else instead of sending to Google that it's a 404 page?


Why are my 'medium' images the wrong size

In my media settings I have:               Thumbnail size  131 x 87     Crop thumbnail to exact dimensions: yes     Medium size     260 x 1000     Large size          560 x 800      But the_post_thumbnail('medium') outputs an image of size 180 x 194px (originally 580 x 630). What have I done wrong? If I look at get_intermediate_image_sizes() I see:               Array     (         [0] => thumbnail         [1] => medium         [2] => large         [3] => kc-large         [4] => slider         [5] => post-thumbnail     )      kc-large and slider are both set in my theme, I think post-thumbnail is a WordPress thing. If I use the Force Regenerate Thumbnails plugin I see that it generates my medium sized images correctly. Any help figuring this out would be greatly appreciated! Toby


Subdomain multisites not working with addon domain

I have tried to setup multisite with sub-domain option in wordpress but its not working I have followed this guide I have domain added in my hostgator addon domain so I set wild card with path on hosting panel > public_html/addon/mysite.com Then I gone through the document and followed the thing I added one site from admin, it's added in list but when I go to dashboard or front end it shows server not found. I tried to add jon.mysite.com but it shows server not found in front and and admin for this url Also I when I open folder blogs.dir from ftp there are no files inside this folder.


Switched hosts to one with cPanel. To transfer my blog should I do the WP install or just be uploading my old WP directory & database?

I've never transferred a website before let alone a database. I believe I backed up the database to an .sql file and I haven't deactivated the old host yet in case I need to do it again. My main question is now that I'm on a host with cPanel should I use the automatic "WP Install" and then upload the database somehow or should I just follow Moving WordPress and just upload all of my folders and files from the backup?


Semantic URL Custom Post Type and Taxonomies permalinks

I have created a custom post type with custom taxonomies. Now I need help with the permalinks. Now is like that:   * custom post type archive: `example.com/custom-post-type/`   * taxonomy archive: `example.com/taxonomy/`   * single custom post type: `example.com/custom-post-type/single/` It should be like that:   * custom post type archive: `example.com/custom-post-type/`   * taxonomy archive `example.com/custom-post-type/taxonomy/`   * single custom post type: `example.com/custom-post-type/taxonomy/single/` How can I achieve that?


Customize Walker_nav_menu to show posts if item is category

I would like to customize the nav menu walker so that when it encounters a category it automatically makes the 5 most resent posts children of the menu item. Is there a way to dynamically add items to the menu object or it better to have a conditional in the start_el function?


Search - Ajax - Alter Query Parameters with Pagination

**Too Long ; Didn't Read** How do I get pagination to work when I'm creating my query with ajax? * * * I'm working on creating a functional search page that allows the user to filter how many posts per page. I don't quite understand how to create it so pagination functions correctly and was hoping somebody could explain it to me. I understand that by creating a new query in my PHP ajax action I thus create new paging and do not alter the normal WP_Query, so I would need to make my pagination function with ajax but i'm not sure how I would connect it to a certain ajax custom query.               function implement_ajax() {              $ppp = 10;         if(isset($_GET['ppp']))             $ppp = $_GET['ppp'];              $search = $_GET['s'];           // Acquired and sent via ajax         $paged = 1;         if(isset($_GET['paged']))             $paged = $_GET['paged'];              $temp = new WP_Query(array('s' => $search, 'posts_per_page' => $ppp));              $numPosts = $temp->post_count;         $foundPosts = $temp->found_posts;         $lastPage = $temp->max_num_pages;              ob_start();         if($temp->have_posts()) :             $i = 0;          ?>             <?php if($temp->max_num_pages > 1) : ?>
                     <?php                          $big = 999999999;                         echo paginate_links(array('base' => '/', 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $temp->max_num_pages));                      ?>

              <?php endif; ?>
                 <?php while($temp->have_posts()) :                          $temp->the_post();                          $i++;                  ?>                          <div class="custom-post<?php echo ($i%2 == 0) ? ' even' : ''; echo ($i == $numPosts) ? ' last' : ''; echo ($i == 1) ? ' first' : ''; ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                         <?php the_excerpt(); ?>
                       <?php endwhile; ?>
               <?php else : ?>

No articles found.

<a href="<?php echo home_url(); ?>">Return Home

          <?php endif;              $htmlContent = ob_get_clean();         echo $htmlContent;         exit;     }     add_action('wp_ajax_nopriv_implement_ajax', 'implement_ajax');     add_action('wp_ajax_implement_ajax', 'implement_ajax');      The above returns the correct query - but pagination is broken since I'm not sure how to set the `base` parameter. I've tried `('/?s='.$search.'?paged='.$paged)` and `/` and a few other ones that have gotten me nowhere. If I use the 'Basic Example' in The Codex: `str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) )` paginate_links return: `/wp-admin/admin-ajax.php?action=implement_ajax&ppp=1&s=web&paged=2` which does return the correct posts, minus the header, footer, and styles. I tried to duplicate what G.M did in this question with localize script but couldn't get past `$args = (array) filter_var(INPUT_POST, 'query');` since parameter 2 was expecting an integer. I tried to just convert my $_POST['query'] to an array but wasn't able to do so. **Relevant File Pastebins:**   1. Search Page   2. Relevant Functions   3. Ajax Jquery Warning - there may be some relics in there, I've been commentings things in and out to try and get this to work.


Contextual help in wp-admin for non admins

i'm having a problem. I have my WP with custom roles, capabilities and so on.. But i'm having a problem in displaying the context help (in top right corner). If i log in as admin-it's all right - it's there, if i login with account which doesn't have admin rights -it's not there. But i want to display help for lower level accounts too, how to do that? I think this is WP core thing..can it be overwritten without changing the core? Thanks. _**my code of diplaying it_** :                 add_action( 'load-post.php', 'wpd_help_post' );       function wpd_help_post() {       $screen = get_current_screen();     //my custom post types         if ( $screen->id == 'albumas' || $screen->id == 'edit-albumas' ) {           $screen->add_help_tab( array(               'id'      => 'wpd-base',               'title'   => __('My title', 'sfc'),               'content' => '
My help text
',           ));         }       }      Well i was stupid this time, everything is working. and no matter of user. I forgot to add action for creating new entry and only added for editing. that's why i was unable to see it.


How to assign classes to all elements?

Is it possible to assign classes to elements of certain type? For example, all paragraphs in the post body or comment body should have class="paragraph", all unordered lists in post body should have class="list", and so on.


Arrange and separate posts

On a particular archive page I've created, I'm listing a number of posts by post name and they're listed in alphabetical order. Is there away to have them separated even further? As in all posts starting with "A" are grouped and have a heading of "A", then all posts starting with "B" are grouped and have a heading of "B", etc.


How to insert custom function into wp_insert_post

i'm trying to send push notification when the wordpress admin insert new post. I was looking for hours where to add my function and after a lot i found core function `wp_insert_post` inside `wp-includes/post.php` that function returns the Post_ID, so i added my custom script before return:               include '../push/send_message.php';     sendNotification($postarr['post_title'],$postarr['guid']);      The problem is that when i import these two rows here               function wp_insert_post($postarr, $wp_error = false) {         ...         if ( $update ) {             do_action('edit_post', $post_ID, $post);             $post_after = get_post($post_ID);             do_action( 'post_updated', $post_ID, $post_after, $post_before);         }         do_action('save_post', $post_ID, $post);         do_action('wp_insert_post', $post_ID, $post);         include '../push/send_message.php';         sendNotification($postarr['post_title'],$postarr['guid']);         return $post_ID;     }      nothing happen and when admin insert new post, the success page is blank. if i remove that line all is ok.. very strange.. Can someone give me a right way to do what i need?


Remove blog slug from WPMU?

i have wordpress MU, everything is fine in child sites , but in the main site in the permalink structure have been changed itself , mean that after the site url it have like http://example.com/blog , most probably this is the site url, i have checked this in my db it still like http://example.com/ , what is wrong with my WPMU? have any guess ? i have followed everything in other posts like WPMU developers and so on , but no luck, Also when, i have to go single page, it redirects into me on home page, so that i decided , this is the problem check my attached screenshot for more details![screenshot](http://i.stack.imgur.com/HvOUJ.png)


What are the differences in capabilities between the super-administrator and administrator?

What are the capabilities that a super-administrator has that an administrator does not have? The codex page on user capabilities does not have a list of capabilities of the super-admin. It lists only the capabilities of the administrator.


Redirecting traffic from old ".WordPress.com" blog to privately hosted WordPress blog?

I've got a blog hosted on .wordpress.com, ie the free version. I'm thinking of re-activating my hosting package so I can have my own WP installation, and therefore have more customisation options open to me etc. I'm getting traffic from search engines, how can I redirect this traffic to my new location? Once I have the new one setup, I would prefer people to view that instead of my old site, what can I do to achieve this, whilst retaining my position in search engines?


Programming WordPress to Send an Email on Registration Form Submit?

_( **Moderator's note:** The original title was: "submit button in wordpress.")_ I'd like to create a registration form to send an email. I've tried Contact Form 7 but I would like to use my own HTML `<form>`. I can do the entire coding but I just want to know the code for the _"submit"_ button so that the registrations goes directly to my admin email ID as I don't think the normal HTML code for the submit button will work. Can anyone help me out in this?


Using WordPress as a CMS: Developer preferences for custom vs existing plugins

I was just wanting to gauge some general feedback on how developers use WordPress as a CMS. I've started having a few client requests for websites built on WordPress. Most of the time, they're pretty simple and the core WordPress functionality works fine. Sometimes though there will be the need for custom functionality, for which I generally browse the thousands of plugins available and use one which suits. However as I build more sites I'm finding that I'm never 100% satisfied with how the plugins work (they either do too much or too little) Do you guys write custom plugins for WordPress sites you build for clients (even if similar ones already exist)? How to you reach a decision when it comes to custom vs existing?


My new WordPress plugin version is not showing up in the plugin directory. It's been 4 days what could the problem be?

Hi to all I made a wordpress plugin amtythumb post. All previous versions are reflected at worpress SVN within some hours. But this time 5.5 version of my plugin is not being reflected on wordpress plugin site even after 3-4 days. just check wordpress plugin site wordpress.org/extend/plugins/amty-thumb- recent-post/ And SVN for confirmation, http://plugins.svn.wordpress.org/amty- thumb-recent-post/amty-thumb-recent-post/tags/. Please let me know what to do...


Why would the login page reload indefinitely?

I tried to log into a blog I administer, after 2+ weeks of no issues, and today I suddenly cannot log in. I have not updated the core or any plugins. The DB hasn't changed, and no significant changes have been made to my system. I've tried IE, Firefox, Chrome, Safari and Opera, clearing cookies before each, in normal and private browsing modes. I've tried renaming my plugins folder and my theme folder. It's not a password issue. The login page just reloads over and over, and it just started happening out of the blue. I've run into many posts about this, and disabling plugins or changing settings on config.php seem to be the most common solutions. But none of these have worked for me! Any new suggestions? **Update** It looks like it's upgraded to 3.5.2 (from 3.5.1) and that may be causing the issues, though I somehow doubt such a small update would cause such a big fuss. Since no one updated it, this leads me to also ask...does WP auto update?


Settings API in Section

I have a snippet that creates an option in Settings->General using Settings API. However, the values don't get updated and I was wondering if anyone can help point out the problem with the following code               function admin_init_callback() {              register_setting( 'msp_settings', 'msp_duration' );              add_settings_section( 'msp_settings', __('Multisite Posts Configuration'), false, 'general' );              add_settings_field( 'msp_duration', __('Cache Duration'), array($this, 'msp_settings_callback'), 'general', 'msp_settings', array(             "id"    => "msp_duration",             "type"  => "dropdown",             "values"=> array(                 array(                     "name"  => __('Every 6 hours'),                     "value" => 60 * 60 * 6,                 ),                 array(                     "name"  => __('Every 12 hours'),                     "value" => 60 * 60 * 12,                 ),                 array(                     "name"  => __('Every 24 hours'),                     "value" => 60 * 60 * 24,                 ),                 array(                     "name"  => __('Every 48 hours'),                     "value" => 60 * 60 * 48,                 ),                 array(                     "name"  => __('Every Week'),                     "value" => 60 * 60 * 24 * 7,                 ),             )         ) );              return;          }          function msp_settings_callback($args) {              $value = get_option( $args["id"] );              if("dropdown" == $args["type"]) {                  var_dump($value);             ?>             <select name="<?php echo $args["id"]; ?>">                 <?php                     foreach ($args["values"] as $option) {                         echo '<option value="' . $option["value"] . '" ';                         checked( $value, $option["value"], $echo = true );                         echo '>' . $option["name"] . '</option>';                     }                 ?>             </select>             <?php              }          }


Dynamically create array from page title

I have a simple page structure like Page One, Page Two, Page Three. Each page has tag of 'content'. In the Wordpress loop how could I create an array for each page with the page title as the array name. My code is like this.                   <?php             $mt_test_args = array(                 'post_type' => 'page',                 'tag' => 'content',                 'order' => 'ASC'             );                  $mt_test_loop = new WP_Query($mt_test_args);                  if($mt_test_loop->have_posts()):                 while($mt_test_loop->have_posts()):                     $mt_test_loop->the_post();                          //Trying to create array here from page title.                      $arr_name = get_the_title();                          $arr_name = str_replace(' ','_',$arr_name);                          $arr_name = array();              ?>                <option><?php the_title(); ?></option>              <?php endwhile; endif; ?>              <?php wp_reset_postdata(); ?>      This is demo code, the actual set up is a lot more complex


Saving two categories from two dropdowns in front end posting form

So, here's the deal: I have two category dropdowns, the first for the parent categories and the second for the child categories. They form a chain so that when you select the parent category the second dropdown will be populated with its child categories. Here's the code in the form itself:                   <script type="text/javascript">         $(function()         {         $('#main_cat').change(function()         {             var $mainCat=$('#main_cat').val();                  // call ajax             $("#sub_cat").empty();             $.ajax             (                 {                     url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",                          type:'POST',                     data:'action=my_special_ajax_call&main_catid=' + $mainCat,                          success:function(results)                     {                         //  alert(results);                         $("#sub_cat").removeAttr("disabled");                                $("#sub_cat").append(results);                       }                 }             );                                             });         });         </script>         <fieldset class="site-url" class="fieldset-first">         <?php wp_dropdown_categories('show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=1&show_option_none=Main Categories&name=main_cat&taxonomy=category');         ?>     </fieldset>     <fieldset class="site-url" class="fieldset-first">     <select name="sub_cat" id="sub_cat" disabled="disabled"></select>     </fieldset>      Here's the code in functions.php:               function implement_ajax() {     if(isset($_POST['main_catid']))         {         $categories=  get_categories('child_of='.$_POST['main_catid'].'&hide_empty=0'.'&taxonomy=category'.'&show_count=0');           foreach ($categories as $cat) {             $option .= '<option value="'.$cat->term_id.'">';             $option .= $cat->cat_name;             $option .= ' ('.$cat->category_count.')';             $option .= '</option>';           }           echo '<option value="-1" selected="selected">Sub Categories</option>'.$option;         die();         } // end if     }     add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');     add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');      The problem is that when saving the values like this:               'post_category' =>   array($_POST['main_cat']),      I'll only get the parent category saved for the post. How on earth can I have the parent AND the child categories both saved? Bear in mind that only one category should be selected from each dropdown, no multiples. Cheers! UPDATED WITH WHOLE POST POSTING/SAVING CODE BELOW:               <?php            if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {              // Do some minor form validation to make sure there is content              require_once('recaptchalib.php');             $privatekey="Oh dear I shouldn't have put my super private API key here for all to see!";                  $resp = recaptcha_check_answer ($privatekey,                                             $_SERVER["REMOTE_ADDR"],                                             $_POST["my_recapthca_challange_field"],                                             $_POST["recaptcha_response_field"]);          if ($resp->is_valid) {              if (isset ($_POST['title'])) {             $title =  $_POST['title'];             $_SESSION['form_values']['title'] = $_POST['title'];         }               if (isset ($_POST['site-link'])) {             $siteurl =  $_POST['site-link'];             $_SESSION['form_values']['site-link'] = $_POST['site-link'];         }          if (isset ($_POST['first-url'])) {             $firsturl =  $_POST['first-url'];             $_SESSION['form_values']['first-url'] = $_POST['first-url'];         }          if (isset ($_POST['price'])) {             $price =  $_POST['price'];             $_SESSION['form_values']['price'] = $_POST['price'];         }              if (isset ($_POST['name'])) {             $devname =  $_POST['name'];             $_SESSION['form_values']['name'] = $_POST['name'];            }               if (isset ($_POST['second-url'])) {             $secondurl =  $_POST['second-url'];              $_SESSION['form_values']['second-url'] = $_POST['second-url'];         }               if (isset ($_POST['country'])) {             $devcountry =  $_POST['country'];              $_SESSION['form_values']['country'] = $_POST['country'];         }              if ($_POST['twitter']=="Twitter Username" || $_POST['twitter']=="Not Available")  {             $twitter =  "Not Available";              $_SESSION['form_values']['twitter'] = $twitter;         }else  {             $twitter = $_POST['twitter'];             $_SESSION['form_values']['twitter'] = $_POST['twitter'];         }              $design =  $_POST['design'];            if ($design=="yes"){$design = "Yes, this is new!";}             else {$design="No, this is old!";}                       $related =  $_POST['related'];            if ($related=="yes"){$related = "Yes, this is related!";}             else {$related="No, this is not related!";}          $responds =  $_POST['responds'];            if ($responds=="yes"){$responds = "Yes";}             else {$responds="No";}          $locale =  $_POST['locale'];            if ($locale=="yes"){$locale = "Yes";}             else {$locale="No";}          $widgets =  $_POST['widgets'];            if ($widgets=="yes"){$widgets = "Yes";}             else {$widgets="No";}          $skins =  $_POST['skins'];            if ($skins=="yes"){$skins = "Yes";}             else {$skins="No";}          $contact =  $_POST['contact'];            if ($contact=="yes"){$contact = "Yes";}             else {$contact="No";}          $press =  $_POST['press'];            if ($press=="yes"){$press = "Yes";}             else {$press="No";}          $comm =  $_POST['comm'];            if ($comm=="yes"){$comm = "Yes";}             else {$comm="No";}          $page =  $_POST['page'];            if ($page=="yes"){$page = "Yes";}             else {$page="No";}          $psd =  $_POST['psd'];            if ($psd=="yes"){$psd = "Yes";}             else {$psd="No";}          $format =  $_POST['format'];            if ($format=="yes"){$format = "Yes";}             else {$format="No";}          $codes =  $_POST['codes'];            if ($codes=="yes"){$codes = "Yes";}             else {$codes="No";}                    if ($_FILES['image']['error']==0) {               // ADD THE FORM INPUT TO $new_post ARRAY         $new_post = array(         'post_title'    =>   $title,     'post_category' =>   array($_POST['main_cat']),         'post_status'   =>   'draft',         'post_type' =>   'post'         );              $pid = wp_insert_post($new_post);         add_post_meta($pid, 'URL', $siteurl, true);         add_post_meta($pid, 'Name', $name, true);         add_post_meta($pid, 'First URL', $firsturl, true);         add_post_meta($pid, 'Country', $country, true);         add_post_meta($pid, 'Twitter', $twitter, true);         add_post_meta($pid, 'Redesign', $redesign, true);         add_post_meta($pid, 'Related', $related, true);     add_post_meta($pid, 'Responds', $responds, true);     add_post_meta($pid, 'Locale', $locale, true);     add_post_meta($pid, 'Widgets', $widgets, true);     add_post_meta($pid, 'Skins', $skins, true);     add_post_meta($pid, 'Contact', $contact, true);     add_post_meta($pid, 'Press', $press, true);     add_post_meta($pid, 'Comm', $comm, true);     add_post_meta($pid, 'Page', $page, true);     add_post_meta($pid, 'PSD', $psd, true);     add_post_meta($pid, 'Format', $format, true);     add_post_meta($pid, 'Second URL', $secondurl, true);     add_post_meta($pid, 'Price', $price, true);     add_post_meta($pid, 'Codes', $codes, true);          wp_set_post_categories($post_id, $_POST['main_cat']);         wp_set_post_tags($post_id, $_POST['post_tags']);                   foreach ($_FILES as $file => $array) {         $newupload = insert_attachment($file,$pid);              }         $imagedata = simplexml_load_string(get_the_post_thumbnail($pid));         $post_img = $imagedata->attributes()->src;              include_once("script/colors.inc.php");         $image = $post_img;         $ex=new GetMostCommonColors();         $ex->image = $image;         $colors=$ex->Get_Color();         $how_many=10;         $colors_key=array_keys($colors);         $colortag = $colors_key[1];         for ($i = 2; $i <= $how_many; $i++)         {         $colortag = $colortag.",".$colors_key[$i];         }              wp_set_post_tags($pid, $colortag);          $_SESSION['error_message'] = 'Submitted successfully.';          $_SESSION['form_values'] = array();          do_action('wp_insert_post', 'wp_insert_post');              }          } else {         if (isset ($_POST['title'])) {             $name =  $_POST['title'];             $_SESSION['form_values']['title'] = $_POST['title'];         }               if (isset ($_POST['site-link'])) {             $siteurl =  $_POST['site-link'];             $_SESSION['form_values']['site-link'] = $_POST['site-link'];         }          if (isset ($_POST['first-url'])) {             $firsturl =  $_POST['first-url'];             $_SESSION['form_values']['first-url'] = $_POST['first-url'];         }          if (isset ($_POST['price'])) {             $price =  $_POST['price'];             $_SESSION['form_values']['price'] = $_POST['price'];         }              if (isset ($_POST['name'])) {             $name =  $_POST['name'];             $_SESSION['form_values']['name'] = $_POST['name'];              }              if (isset ($_POST['second-url'])) {             $secondurl =  $_POST['dev-url'];              $_SESSION['form_values']['second-url'] = $_POST['second-url'];         }              if (isset ($_POST['country'])) {             $country =  $_POST['country'];              $_SESSION['form_values']['country'] = $_POST['country'];         }              if ($_POST['twitter']=="Twitter Username" || $_POST['twitter']=="Not Available")  {             $twitter =  "Not Available";              $_SESSION['form_values']['twitter'] = $twitter;         }else  {             $twitter = $_POST['twitter'];             $_SESSION['form_values']['twitter'] = $_POST['twitter'];         }              $redesign =  $_POST['redesign'];            if ($redesign=="yes"){$redesign = "Yes, this is new!";}             else {$redesign="No, this is old!";}                       $related =  $_POST['related'];            if ($related=="yes"){$related = "Yes, this is related!";}             else {$related="No, this is not related!";}          $responds =  $_POST['responds'];            if ($responds=="yes"){$responds = "Yes";}             else {$responds="No";}          $locale =  $_POST['locale'];            if ($locale=="yes"){$locale = "Yes";}             else {$locale="No";}          $widgets =  $_POST['widgets'];            if ($widgets=="yes"){$widgets = "Yes";}             else {$widgets="No";}          $skins =  $_POST['skins'];            if ($skins=="yes"){$skins = "Yes";}             else {$skins="No";}          $contact =  $_POST['contact'];            if ($contact=="yes"){$contact = "Yes";}             else {$contact="No";}          $press =  $_POST['press'];            if ($press=="yes"){$press = "Yes";}             else {$press="No";}          $comm =  $_POST['comm'];            if ($comm=="yes"){$comm = "Yes";}             else {$comm="No";}          $page =  $_POST['page'];            if ($page=="yes"){$page = "Yes";}             else {$page="No";}          $psd =  $_POST['psd'];            if ($psd=="yes"){$psd = "Yes";}             else {$psd="No";}          $format =  $_POST['format'];            if ($format=="yes"){$format = "Yes";}             else {$format="No";}          $codes =  $_POST['codes'];            if ($codes=="yes"){$codes = "Yes";}             else {$codes="No";}          $_SESSION['error_message'] = 'You will need to enter the correct captcha value. Please try again!';             }          }          ?>


Blog Settings import/export in Wordpress Network environment

I can't use PHPMyAdmin to export/import my blogs from one server to an other because I'm using Wordpress Network. Export/import works pretty well for Posts, custom posts types and their media, but not for the Blog settings themselves How could I export my blog settings? Some examples:   * sizes for Thumbnails, medium, large images   * Pictures cropping   * Date format   * show excerpts   * how many articles per pages   * ... my main goal being to apply all my beta website settings to the main website when fully tested and approved.


Only show Previous & Next button in Pagination

I'm trying to alter the pagination of WP so that it shows ONLY a Previous and/or Next button, and NOT the pages in between. Using this snippet from the Codex:               <?php     global $wp_query;          $big = 999999999; // need an unlikely integer          echo paginate_links( array(     'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),     'format' => '?paged=%#%',     'current' => max( 1, get_query_var('paged') ),     'total' => $wp_query->max_num_pages     ) );     ?>      And these parameters:               <?php $args = array(     'base'         => '%_%',     'format'       => '?page=%#%',     'total'        => 1,     'current'      => 0,     'show_all'     => False,     'end_size'     => 1,     'mid_size'     => 2,     'prev_next'    => True,     'prev_text'    => __('« Previous'),     'next_text'    => __('Next »'),     'type'         => 'plain',     'add_args'     => False,     'add_fragment' => ''     ); ?>      But I can't get it right! It always shows: `1 2 next or previous 1 2` And I'm trying to get this: `next previous` Can this be done by altering the parameters?


Problem deleting posts from trash

My clients has recently had a problem with spam posts being added to their blog, under various usernames. The users have been deleted, but Wordpress is not able to remove the posts from the trash. Using the 'Empty Trash' button does not work either. Removing directly from the database appears to work, but as there are 4000+ entries this would take a long time. This is Wordpress v3.4.1 and has been upgraded recently. Can anybody help?


How to detect if a function has been fired on any page so scripts/styles can be loaded conditionally

I'm building a small gallery plugin and I'd like to only load scripts/styles onto the page IF the gallery has been loaded via the template tag. The template tag can take a post ID parameter when used to call a post's gallery from wherever you need within the theme. I know how to do this on singular pages (I can just lookup the meta_key and match it against the currently viewed post) but detecting if there's a gallery present on say the homepage (or any other page) is proving more difficult. So let's assume the template tag looks something like this:               if ( function_exists( 'my_gallery' ) )         echo my_gallery( '100' ); // gallery of image from post 100 will be shown      And the gallery function looks like this (simplified):               function my_gallery( $post_id = '' ) {         // whole bunch of stuff in here which is returned     }      The scripts and styles for the gallery would look like this (simplified):               function my_gallery_scripts() {             wp_register_script( 'my-gallery-js', MY_GALLERY_URL . 'js/my-gallery.js', array( 'jquery' ), '1.0', true );        wp_register_style( 'my-gallery-css', MY_GALLERY_URL . 'css/my-gallery.css', '', '1.0', 'screen' );              // need to load these conditionally, but how?         wp_enqueue_style( 'my-gallery-js' );         wp_enqueue_script( 'my-gallery-css' );          }     add_action( 'wp_enqueue_scripts', 'my_gallery_scripts' );      I've tried using `set_query_var` inside `my_gallery()` like this to kind of set a global variable inside $wp_query.                function my_gallery( $post_id = '' ) {              set_query_var( 'has_gallery', true );              // whole bunch of stuff in here which is returned     }          The problem though is that I can't use `get_query_var` inside the `wp_enqueue_scripts` action. So the following would be ideal for me I believe, loading has_gallery into the $wp_query object which would be available to me on every page (except it doesn't work).                function my_gallery_scripts() {             wp_register_script( 'my-gallery-js', MY_GALLERY_URL . 'js/my-gallery.js', array( 'jquery' ), '1.0', true );        wp_register_style( 'my-gallery-css', MY_GALLERY_URL . 'css/my-gallery.css', '', '1.0', 'screen' );              // does not work         $has_gallery = get_query_var( 'has_gallery' );              if ( $has_gallery ) {             wp_enqueue_style( 'my-gallery-js' );             wp_enqueue_script( 'my-gallery-css' );         }     }     add_action( 'wp_enqueue_scripts', 'my_gallery_scripts' );      Is there another way to set a global option similar to set_query_var but will work in my scenario? I'd like to obviously avoid the use of a global variable. I've also tried setting a constant to no avail.


WPSE Plugin Repository: The plugins that came out of WP-Answers

### Link your WPSE-Plugins If you answered a question and made a plugin out of your code, than this is your place to share it. **The Idea:** An old comment from _@MikeSchinkel_ during the beta phase where he wrote something like "I wonder how many plugins will come out of WA". ### "Rules"   * Write a short - _one line_ \- description of what the plugin is intended to do.   * Tell how it's meant to be used: Template Tag, Shortcode, Widget, Plug & Play.   * Link to your plugins in an answer, on github/bitbucket/whatever or in the wp.org repo.   * Please _link one plugin per answer_.   * If you got some answers that would serve well as plugin, just modify your A and link it here.   * If your plugin became a commercial plugin later, it's ok to post the link here.   * If your plugin is not cc- _plus_ GNU GPL 2-licensed, please mention the license. * * * _Notes:_   * I added a tag named wpse-plugin to this answer. Please edit the Q (where your Answer ended up as a plugin) and add the tag, or ask a moderator to do so.   * I'll upvote any Answer/Plugin added here.   * Please also join the discussion about this on meta. * * * **Important:** About License As to a lot of discussion about copyright & open source licenses1), i want to mention that these plugins run under the cc-license _plus_ the GNU GPL 2-license, if the author didn't mention else. 1) Some related discussion examples:   * @EAMann   * Joost de Valk


add_menu_page include a php page from theme directory

I have added some custom tables to a wordpress and trying to add wp-admin section to manage them. By using following code I have successfully added a menu item in wp-admin but I'm unable to call the php page that resides into my theme folder               add_menu_page('Private Messages', 'Private Messages', 'manage_options',                   'message_admin', 'message-admin.php',                    get_bloginfo('stylesheet_directory').'/style/images/message.png');      in error_log it gives me this error > PHP Warning: call_user_func_array() expects parameter 1 to be a valid > callback, function 'message-admin.php' not found or invalid function name in > /var/www/idon.dev/wp-includes/plugin.php on line 470, referer: > http://idon.dev/wp-admin/admin.php?page=message_admin **Update:** The wordpress says > $function > > (string) (optional) The function that displays the page content for the menu > page. Default: None. Technically, the function parameter is optional, but if > it is not supplied, then WordPress will assume that including the PHP file > will generate the administration screen, without calling a function. **Most > plugin authors choose to put the page-generating code in a function within > their main plugin file. In the event that the function parameter is > specified, it is possible to use any string for the file parameter.** This > allows usage of pages such as ?page=my_super_plugin_page instead of > ?page=my-super-plugin/admin-options.php. I know what does it mean > PHP Warning: call_user_func_array() expects parameter 1 to be a valid > callback, function but what I'm trying to achieve is to call a page rather of function. what is according to wordpress is possible, or guide me if I'm wrong. Please note that I don't want to include page in functions, I will rather be happy to add my code into function.


Change News Story Layout Based on Date Range

My website has been up for 10 years and as such has gone through various layout changes. Whenever I have made a new layout, I have added all news stories that were made under that layout into a new Wordpress category so I could target said stories and keep the same layout applied to them. This is the code I've used:               <?php rewind_posts(); ?>     <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>     <?php if ( in_category('2563') ): ?> (layout coding)     <?php elseif ( in_category('919') ): ?>  (layout coding)     <?php elseif ( in_category('3') ): ?> (layout coding)     <?php else: ?> (layout coding)     <?php endif; ?>     <?php endwhile; ?>      I'm once again changing my layout, but I don't want to keep making new categories since it just makes things look messy. So I was wondering if there was a way to instead of basing the news story layouts on category, to base them on their creation date. So I would like to be able to do something like... "if X story was published between 7/15/03 at 1:03 PM and 9/19/07 at 11:34 AM, use the following layout." Like the code above, but with time/date ranges. Does anyone know if this is possible? Thank you so much!


is_user_logged_in() isn't working

I'm making a login form for my site, and I've this section:               <?php     if (is_user_logged_in()) {         echo 'Hello, ', $user_login, '. Logout';     } else {         wp_login_form();     }     ?>      And after loggin in, it returns to the page with no indication of logging in.   I suspect is_user_logged_in() isn'tw orking, but I don't know how to debug this problem. EDIT: Whenever I do this:               global $current_user;          var_dump($current_user);      I always get:               ect(WP_User)#3 (7) { ["data"]=> NULL ["ID"]=> int(0) ["caps"]=> array(0) { } ["cap_key"]=> NULL ["roles"]=> array(0) { } ["allcaps"]=> array(0) { } ["filter"]=> NULL }      No matter if i"ve 'logged' in with the above form.


How to display comments on different page

I am creating a reviews site and I want to display the customer reviews (comments) on a separate page from the single-restaurant.php. I'll just have a link that says (Read reviews/ add yours). I created a custom comments template and called it comments-side.php and this is what I have in it:               <?php     /**      * Comments Template      *      */          ?>

                      <?php if ( have_comments() ) : ?>                          <?php do_atomic( 'before_comment_list' );// supreme_before_comment_list ?>
                     <?php $args = array(         'walker'            => null,         'max_depth'         => '10',         'style'             => 'ul',         'callback'          => 'mytheme_comment',         'end-callback'      => null,         'type'              => 'all',         'reply_text'        => 'Reply',         'length'            => '10',         'page'              => '',         'per_page'          => '3',         'avatar_size'       => 32,         'reverse_top_level' => null,         'reverse_children'  => '',         'format'            => 'xhtml', //or html5 @since 3.6         'short_ping'        => false // @since 3.6     ); ?>                         <?php wp_list_comments( $args, $comments); ?>
                                      <?php endif; ?>
                  <?php $comment_args = array( 'fields' => apply_filters( 'comment_form_default_fields', array(                             'author' => '
' .                                         '<input id="author" name="author" type="text" value="' .                                         esc_attr( $commenter['comment_author'] ) . '" size="30"' . @$aria_req . ' PLACEHOLDER="'.__('Your name','supreme').'"/>' .                                         ( $req ? ' *' : '' ) .                                         '
',                             'email'  => '
' .                                         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . @$aria_req . ' PLACEHOLDER="'.__('Email Address','supreme').'"/>' .                                         ( $req ? ' *' : '' ) .                                 '
',                             'url'    => '
' .                                         '<input id="url" name="url" type="text" value="' . esc_attr(  $commenter['comment_author_url'] ) . '" size="30"' . @$aria_url . ' PLACEHOLDER="'.__('Website','supreme').'"/>'.'
')),                             'comment_field' => '
' .                                         '<textarea id="comments" name="comment" cols="45" rows="8" aria-required="true" PLACEHOLDER="'.__('Comments','supreme').'"></textarea>' .                                         ( $req ? ' *' : '' ) .                                         '
',                             'comment_notes_after' => '',                             'title_reply' => __( 'Add a comment', 'supreme' ),                         );                         if(get_option('default_comment_status') =='open'){                             comment_form($comment_args); } // Loads the comment form.  ?>

      However, when I try to go to the comments template (http://myurl.com/post- slug/comments-side/), the page throws a 404 error. I changed permalinks to the default setting and switched it back to /%postname%/ but I still get the 404. How do I get this to work properly? I don't know if it is relevant but this is what I have in my functions.php for the comments:               function mytheme_comment($comment, $args, $depth) {             $GLOBALS['comment'] = $comment;             extract($args, EXTR_SKIP);                  if ( 'div' == $args['style'] ) {                 $tag = 'div';                 $add_below = 'comment';             } else {                 $tag = 'li';                 $add_below = 'div-comment';             }     ?>             <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">             <?php if ( 'div' != $args['style'] ) : ?>             <div id="div-comment-<?php comment_ID() ?>" class="comment-body">             <?php endif; ?>
             <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>             <?php printf(__('%s says:'), get_comment_author_link()) ?>
     <?php if ($comment->comment_approved == '0') : ?>             <?php _e('Your comment is awaiting moderation.') ?>
     <?php endif; ?>
<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">                 <?php                     /* translators: 1: date, 2: time */                     printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','' );                 ?>
                  <?php comment_text($comment_ID); ?>                   <a href="comments-side/#comment-<?php comment_ID() ?>" class="comment-more">read more
             <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
             <?php if ( 'div' != $args['style'] ) : ?>
             <?php endif; ?>     <?php             }      This is what I have in single-restaurant.php to show the recent comments for that each single post from the "restaurants" post type

Recent Reviews
       <?php comments_template( '/comments-side.php', true ); // Loads the comments-side.php template. ?>


Self-installed WP: blog posts not appearing on homepage

I run the website for our company. I'm not a programmer. It's a small two- person company, so I basically have to do it alone. We're changing to a new server host soon, so I tried backing up and duplicating our website to a test area in our new server. With a few minor exceptions, most things went by without a hitch... except that the blog entries are not appearing on the homepage, as it's supposed to. Please check out what I'm describing:   * the actual website with the first 10 blog entries bellow the big banner: http://www.audiolog.pt   * the test website (note: the banner is missing on purpose. It's the missing blog posts below that are puzzling me): http://www.the-microphone-spa.com/audiologtest Could someone please advise on how to proceed? How can I make the blog entries appear to complete the website duplication? Not sure how to go from here... Thanks!


Use Cron to modify posts via sql

Hi to all I need to run this twice a day:               UPDATE wp_posts SET post_content = REPLACE ( post_content, '[img]', '<img src="' );     UPDATE wp_posts SET post_content = REPLACE ( post_content, '[IMG]', '' );     UPDATE wp_posts SET post_content = REPLACE ( post_content, '[/IMG]', '" />' );     UPDATE wp_posts SET post_content = REPLACE ( post_content, '[b]', '' );     UPDATE wp_posts SET post_content = REPLACE ( post_content, '[B]', '' );     UPDATE wp_posts SET post_content = REPLACE ( post_content, '[/b]', '' );     UPDATE wp_posts SET post_content = REPLACE ( post_content, '[/B]', '' );      How can do it? I don't want to run it manually and I can't do it each time a post is published because I'm running a MU website and my authors are too lazy to modify their code from bbCode to HTML. I'm using cPanel so I can add a CronJob easily if you teach me how to do it. Thanks to all!


How to remove date from showing in meta description

When my results show in Google for the respective keywords, in the meta description I see the date as well. Is there a way to remove the date? Example meta description shows up as: 15 Jun 2009 ... My meta description I use FV Simplr SEO and very pleased with it.. Would like to know if there's a hack for this.


How do I order by multiple custom fields using wp_query?

I have a rating system where the user can enter a custom field of either "Stars" or "Hearts", but whichever one they choose they have to enter a value of 1 thru 5. Using wp_query, I can successfully sort by one of these custom fields, but I'm not sure how to sort by both. Here is the code I'm using to sort by one of the custom fields "Stars":               $args=array(     'posts_per_page' => $con_review_num,     'post_type' => 'con_product_reviews',     'paged' => $paged,     'orderby' => 'meta_value',     'order' => 'DESC',     'meta_key' => 'Stars'        );      Here is what I wish this function would do (notice the last line):               $args=array(     'posts_per_page' => $con_review_num,     'post_type' => 'con_product_reviews',     'paged' => $paged,     'orderby' => 'meta_value',     'order' => 'DESC',     'meta_key' => 'Stars Hearts'         );      Is there another way to do that?


Click on banner to register to the blog

Hi to all I would like to add a "premium" section to my wordpress blog and I would like to force users to click on a banner before being allowed to register to my blog, any step 2 step idea on how to solve this problem? The banner will be html or js. Thanks a lot to all!


tinymce "Link" popup throwing error, not working

I am unable to access the new lightbox-style link popup window. When I try to open it, I get an "error on page" message, and the popup doesn't appear. I've tried on ffx, ie & chrome, on a pc and a mac. I go to work and all is well, on all those same browsers, pc & mac. I can't find any pattern. I've logged out & back in again, cleaned cache, refresh, yada, yada. Does anyone have any idea what could be causing this and how i might fix it?


How can I make this WordPress site actually record the edits I make in the HTML editor?

For a WordPress site I'm editing, the HTML editor will not transfer any of the updates I save in the HTML code to the actual website. All of the pages are left completely blank when I check them despite there being a lot of content on the actual page. How do I edit this HTML content? Where could this WordPress be saving its HTML code to? The last WordPress site I edited always had HTML code saved in the text editors for the pages and always saved the code I wrote there to the actual page.


Posts are being posted in two categories instead of 1

When I create a post and assign the relevant category, the post ends up in the category I've assigned it to and another category. For example when I load a post to graphic design it automatically goes to blog as well. I want my graphic design and my blog to be separate. I've done some research but I don't know what to do.


Image uploading stuck on "crunching"

I have a problem to upload images to the media library when is used multi-file uploader on WP 3.5.2. Single file media uploader works fine. I have tested it with 1k PNG image, which was stuck on "crunching" anyway. Debug log for that part came with those messages:               [23-Jul-2013 13:41:28] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/animals/public_html/mysite.com/wp-includes/functions.php on line 2925     [23-Jul-2013 13:41:28] PHP Notice:  has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in /home/animals/public_html/mysite.com/wp-includes/functions.php on line 2925     [23-Jul-2013 13:41:28] PHP Notice:  get_theme_data is deprecated since version 3.4! Use wp_get_theme() instead. in /home/animals/public_html/mysite.com/wp-includes/functions.php on line 2841      Also when I try to use Image Uploader from Featured Image it comes with that error message:               An error occurred in the upload. Please try again later.      Looks like it is WP related issue rather than hosting/permissions. WP_MEMORY_LIMIT is set to 128M, PHP mem limit is same and PHP upload limit is 5M. As further testing it looks like is related to the Media Library. If I will reset DB and leave all as is it works. When I will re-upload DB with almost 12,000 image it crashes. Thanks


Split the content of single.php by more tag and split texts and photos

I am trying to sprit the_content() by more tag. But I cannnot think of how to write the code for the photos(images) before and after more tag. Photos exists none or more by the post. If anyone know what to do or the code               <?php if(is_user_logged_in()): ?>                  <?php             $content = get_the_content();             $content = preg_replace("|(]+>)|si","",$content);             echo $content;         ?>     <?php else: ?>                  <?php              global $more;             $more = 0;             $content = get_the_content('' , FALSE, '');             $content = preg_replace("|(]+>)|si","",$content);             echo $content;                 if ($pos=strpos($post->post_content, '')):                     echo '<button>LOGIN</button>';                 endif;          ?>     <?php endif; ?>               <?php if(is_user_logged_in()): ?>         Images before more     <?php else: ?>         Images after more     <?php endif; ?>


Error - only variables can be passed by reference

I've Googled quite a bit to find out details, but all of the pages that come up have nothing to do with the file that's generating this error. For me, it's `plugin.php` in `wp-admin/includes`, on line 535. Here's the code:                   if ( !in_array($plugin, $current) ) {                 if ( !empty($redirect) )                         wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error                 ob_start();                 include_once(WP_PLUGIN_DIR . '/' . $plugin);      The `wp_direct` call is line 535. Why is this happening and how can I fix it? I think this is causing blank pages to come up.


Who to echo custom post type on submenu page

i have custom post type and i want to echo the content of it in submenu page like these                   <?php          function codex_custom_init() {       $labels = array(         'name'               => 'Books',         'singular_name'      => 'Book',         'add_new'            => 'Add New',         'add_new_item'       => 'Add New Book',         'edit_item'          => 'Edit Book',         'new_item'           => 'New Book',         'all_items'          => 'All Books',         'view_item'          => 'View Book',         'search_items'       => 'Search Books',         'not_found'          => 'No books found',         'not_found_in_trash' => 'No books found in Trash',         'parent_item_colon'  => '',         'menu_name'          => 'Books'       );            $args = array(         'labels'             => $labels,         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'show_in_menu'       => true,         'query_var'          => true,         'rewrite'            => array( 'slug' => 'book' ),         'capability_type'    => 'post',         'has_archive'        => true,         'hierarchical'       => false,         'menu_position'      => null,         'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )       );            register_post_type( 'book', $args );     }     add_action( 'init', 'codex_custom_init' );               function bookf() {         //Add Submenu Page         add_submenu_page( 'edit.php?post_type=book', 'to edite Teams', 'EDite Teams', 'manage_options', 'bookf', 'bookout' );     }     add_action( 'admin_menu', 'bookf' );               function bookout() {          Echo "the content of book Custom post type same that show on all book : edit.php?post_type=book ";          }                         ?>


How to properly modify get_userdata in plugin to get roles to update in database

I wasn't sure if starting a new question was appropriate, but the questions are completely different from my original ones and code has changed since originally asking for help. This is still the same project but I'm trying to fix code so it works. Thanks to those who explained using get_userdata in the plugin caused roles being added to everyone and not just the currently logged in user. **Plugin Concept** : Login a user from a forum into WordPress, assign role based on the secondary user group of the forum. So far - I can almost get this working by using get_userdata() and calling a class which assigns the roles. Unfortunately this assigns all roles to the user if the current user goes to a post belonging to a different author. Here is the current code. This adds the role to the database for the user_id. It's just adding all roles because - as someone suggested - get_userdata is for all users.               In plugin file /includes/users.php          if ( !function_exists('get_currentuserinfo') ) :          /**      *      * @return void|boolean      */          function get_currentuserinfo() {         global $current_user, $user_ID, $XF;              if ( ! empty( $current_user ) ) {             // same as get_currentuserinfo() in pluggable         }              if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {             wp_set_current_user( 0 );             return false;         }              $visitor = $XF->visitor;              $user_ID = $visitor->get('user_id');              //This is the faked Wordpress login and logout routines          if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) && $visitor->get('user_id') != 0 ) {                  global $wpdb;                  /* Logged in XF session but no WP session */             if (!function_exists('wp_set_auth_cookie')) {                      wp_set_auth_cookie( $visitor->get('user_id') );                  }         }              elseif( !empty( $_COOKIE[LOGGED_IN_COOKIE] ) && $visitor->get('user_id') == 0 ) {                  /* we have a logged in WP session but no XF session */             wp_clear_auth_cookie();         }              /* If no XenForo user is logged in */         if ( $visitor->get('user_id') == 0 ) {             $current_user = null;             wp_set_current_user( 0 );             return false;         }              $current_user = get_userdata( $visitor->get('user_id'), true );         wp_set_current_user( $visitor->get('user_id') );     }          endif;          if ( !function_exists('get_userdata') ) :          /**      * Retrieve user info by $user_id      *      * @param unknown $user_id      * @return boolean|unknown|WP_User      */          function get_userdata( $user_id ) {         global $wpdb, $XF, $WP_User;              if ( !is_numeric( $user_id ) )             return false;              if ( empty( $user_id ) )             return false;              $user_id = absint( $user_id );         if ( !$user_id )             return false;              /**          * Check $user is in cache object          */              $user = wp_cache_get( $user_id, 'users' );              if ( $user ) {             return get_user_by( 'id', $user_id );         }              /**          * Initialize new $user          */              $user = new WP_User;              XFUserData::fillUserData($XF->visitor, $user, $user_id);              update_user_caches( $user );              /**          * This is a check for has_prop. Will remove later.          */              if ( $user->has_prop( 'twitter' ) ) {             echo '';         }              return get_user_by( 'id', $user_id );     }          endif;          In file /public/xfuserdata.php          class XFUserData {          public static function fillUserData($visitor, $classObj, $user_id) {         global $XF;                  if( $user_id != 0 ) {                      $userModel = $XF->getModelFromCache('XenForo_Model_User');                      $user = $userModel->getUserById( $user_id, array('join' => XenForo_Model_User::FETCH_USER_FULL) );                      $classObj->userObj = $user;                      if( $user_id == $visitor->get('user_id') ) {                          // Calls set_user_roles to establish WordPress Roles                          XFUserData::get_user_roles($classObj, (string)$visitor->get('user_group_id'), $visitor->get('secondary_group_ids'));                          // $classObj->ID =                           return $classObj;                      } else {                          // Fill in permission based fields                     // $user['user_id']                          XFUserData::get_user_roles($classObj, (string)$user['user_group_id'], $user['secondary_group_ids']);                               // $classObj->ID =                          return $classObj;                      }             }              }          public static function get_user_roles( &$classObj, $user_group_id, $secondary_group_ids )  {         /**          * Function get_user_roles(&$classObj, $user_group_id, $secondary_group_ids)          *          * This function sets the current user role based on the secondary group          */         global $XF, $wp_roles;              $user_groups = explode( ',', $secondary_group_ids );         $user_groups[] = $user_group_id;              /**          * Loop through the user_roles and find the WP role equivalent for each          */         $user_roles = array();         foreach( $user_groups as $user_group ) {                  $user_roles[] = $XF->options['xf_user_role'][$user_group];                  $new_roles = $XF->options['xf_user_role'][$user_group];                  $user_id = $XF->visitor->get('user_id');                  $user = new WP_User( $user_id );                      echo '
Before Conditional
';                 echo 'This is the user_id ' . $user_id . '
';                 print_r( $classObj->userObj );                 echo '
';                  if( $new_roles === 'administrator' ) {                 $user->set_role('administrator');             }                  elseif( $new_roles === 'editor' ) {                 $user->set_role('editor');                      echo '
Editor Area
';                 echo 'This is user_id ' . $user_id . '
';                 var_dump( $user );                 echo '
';             }                  elseif( $new_roles === 'author' ) {                 $user->set_role('author');             }                  elseif( $new_roles === 'contributor' ) {                 $user->set_role('contributor');             }                  elseif( $new_roles === 'subscriber' || $new_roles === '' || $new_roles === null ) {                 $user->set_role('subscriber');             }                  return false;         }              return;     }      My hope was to simply rename get_usermeta to get_xf_usermeta ... but after the past 10 plus hours of trying all types of changes, I'm at a loss. Changing the function name almost works. The role is available for just that single user (var_dump shows this) but the role is never added to the database as it is when get_userdata is the function name. Clearly I'm missing a step to get the role added to the database when the get_userdata is no longer used. Does anyone have any suggestions? The codex and a plugin development book I have just don't go into this type of detail for me (or I'm completely misunderstanding) and I'm too new to this but after weeks of struggling I've been asking here. I appreciate any direction and suggestions. **UPDATE** This is not exactly right but the wp_capabilities are now written to the database. Unfortunately the user gets the "You do not have sufficient permissions to access this page." despite having editor role and capabilities. This is the change in xfuserdata.php                           elseif( $new_roles === 'editor' ) {                      $capabilities = array (                     "editor",'delete_others_pages','delete_others_posts','delete_pages','delete_post','delete_private_pages','delete_private_posts','delete_published_pages','delete_published_posts','edit_others_pages','edit_others_posts','edit_pages','edit_posts', 'edit_private_pages','edit_private_posts','edit_published_pages','edit_published_posts','manage_categories','manage_links','moderate_comments','publish_pages','publish_posts','read','read_private_pages','read_private_posts'                 );                 $user->add_role('editor');                 update_user_meta( $user_id, 'wp_capabilities', $capabilities );                  }      **UPDATE** I finally solved this problem after watching Nacin's WordPress TV talk regarding Roles & Capabilities as well as looking at many different options. If you see a better way then please let me know. But first recognize add_cap and add_role failed in this class's method. I have no idea why but update_user_meta works as long as the array is done with a true.                           $user_id = $XF->visitor->get('user_id');                  $user = new WP_User( $user_id );                  if( $new_roles === 'administrator' ) {                           if ( is_multisite() && is_super_admin() ) {                           grant_super_admin($user_id);                      } else {                      $capabilities = array ( 'administrator' => true );                      update_user_meta( $user_id, 'wp_capabilities', $capabilities );                      }                 return;             }                  elseif( $new_roles === 'editor' ) {                      $capabilities = array ( 'editor' => true );                 update_user_meta( $user_id, 'wp_capabilities', $capabilities );                 return;                  }                  elseif( $new_roles === 'author' ) {                      $capabilities = array ( 'author' => true );                 update_user_meta( $user_id, 'wp_capabilities', $capabilities );                 return;                  }                  elseif( $new_roles === 'contributor' ) {                      $capabilities = array ( 'contributor' => true );                                 update_user_meta( $user_id, 'wp_capabilities', $capabilities );                          return;             }                  elseif( $new_roles === 'subscriber' || $new_roles === '' || $new_roles === null ) {                      $capabilities = array ( 'subscriber' => true );                 update_user_meta( $user_id, 'wp_capabilities', $capabilities );                 return;                  }


Str_replace using shortcode with multiple changes

I am using a feed importer plugin which gives the option to use a short code in case I need to change data (in this case data for a custom field) on import, using for example:                   [str_replace('This','that',{feedfield})]      But how do I use this when I have more to change? Because it's a shortcode I can't use an array like:                   $a = 'this', 'another this';         $b = 'that', 'another that';         echo str_replace($a, $b, get_post_meta($post->ID, 'feedfield', true));      Can anyone enlighten my lack of knowledge?


Is it possible to use WP_USER_QUERY to search by username using a wildcard?

As above guys, I'm trying to build an AJAX search that works within BuddyPress WITHOUT modifying core code, but that allows me to use a wildcard when I'm searching by username. Any suggestions?


Permalink structure as code in back-end?

I have this `permalink structure`: `/%year%/%monthnum%/%postname%/` What I want to is, output the link of a post in the back-end and let users input a postname, that will automatically lead to that post (if it exists, otherwise 404)... So, I have this:               function transform_pseudo_anchor_wpse_101201($match) {       if (isset($match[1])) {         return '(link: '.$match[1].')';       }     }          $content = preg_replace_callback(       '%\(link: ?(.*?) ?\)%',        'transform_pseudo_anchor_wpse_101201',        $content     );      echo $content;       Of course, this does not work... But how can I make it work? So I want the get the exact link if someone links to a post that exists... So after example.com, the year/monthnum and postname has to come...


Add custom ID to wp_nav_menu list items

Is it possible to assign specific ID's to wp_nav_menu list items? For example, if my menu contained links for "Home", "About" and "Contact", could I assign the "Home" list item and ID of "home"?


adding a button to the media uploader

I am writing a plugin for Wordpress and am wondering how to add an extra button to the media uploader that says something like "add to album". I can't seem to find info on how other developers have managed to get this done. Thanks :)


Displaying a custom taxonomy term's name & description

How can I display a term's name & description for a custom taxonomy within The Loop (single post page template)? Currently I can show its name like this:               the_terms( $post->ID , 'director', 'director: ');      but can't get the description **EDIT**   I dont want to use extra php coding like:               $directors = get_the_terms($post->ID ,'director');     foreach($directors as $director){         $director_name = $director->name;         $director_desc = $director->description;     }


How can I send an id over the url?

I need to send an id that I am going to collect and use in a plugin. Plugin will collect it in a page where I use plugins shortcode. The url I am trying to get is like www.example.com/device/devicename-id. Any idea on how can I do this?


Issue with hide and display horizontal scroll accoucement bar

**I am using horizontal-scrolling-announcement plugin to announce a news bellow the header.I have added some custom code to hide and display scrolling news announcement at one event if the admin change the status display no or yes from back end and its working good for Firefox browser. Before the customize the plugin if i set the status display no it was scrolling news with text "No announcement available.   But the problem is that in chrome browser when i set status display no from back end code work properly and if i set status yes this time it's not scroll the news in chrome but work with fire fox. Now the display status is yes from back end.** Site link:- click here                if ( ! empty($data) )                  {             //Display news                   }             else                 {                  ?> <style >                      .breaking-news{             visibility:hidden;                  height:0;             width:0;             opacity:0;                   }        </style>             <?php                 /*  $what_marquee = $what_marquee . "No announcement available.";                     if($group <> "")                     {                         $what_marquee =  $what_marquee . " Please check this group " . $group;                     }                    */                  }                       return $what_marquee;                  }


WooCommer Product Category Loop - How to change the display order of the rating and price?

I want to do a very very simple thing : To re-order the display of the rating and price information on a WooCommerce product category loop. Now in the product category page I got 5 products, all of the same layout: \--THUMBNAIL--   | Product name   | Rating   | Price   | Add to Cart   Now I just want to make it like this: \--THUMBNAIL--   | Product name   | Price   | Rating   | Add to Cart   I know the code just lies somewhere between the hooks; but just cannot find anyway to make it work. If anyone has ever dealt with this problem, please help show me a way to work with this. I would appreciate this very very very much. Thank you.


How to check if the current page's parent is one of 2 different ID's

I'm using this little snippet right now to check if the current page is the child of a particular page;               $studies_parent = 5860;     if ($studies_parent == $post->post_parent) {      Which is working fine, although now I need to check if the current page is a child of one of 2 different ID's and I'm not sure how to go about it. Basically I need to check if the current page's parent is either 5860 or 1047. Any ideas how I'd do that?


Error 404 for JQuery import "jquery-1.10.2.min.map"

I got my WordPress 3.6 installation running using a theme I have bought. When I'm using my theme the console says:               GET ...xyz.de/landing/wp-includes/js/jquery/jquery-1.10.2.min.map 404 (Not Found)      This error does not appear when using the default theme. This seems like a broken import of a jQuery file. The site seems to work with the theme enabled. Where should I start looking to fix this in a theme not written by me? Best regards, Chris


Array of user ids to list of user names

I'm outputting an array of user ids from metadata like so:   `$awaygoalby = unserialize($post_meta_data['report_away-scorers'][0]);` and I want to change each user id to the user name. So I was hoping to do something like this:               foreach($awaygoalby as $string){     $name = get_userdata( $string );     echo $name;     }      Unfortunately I get an error saying that the "Object of class WP_User could not be converted to string." What is the best way of doing this?


How to receive notifications when a new user registers

I am running a WordPress site for real estate and I cannot seem to figure out how to receive an email when a new user registers or downloads information from my site. If anyone could help me figure out how to turn these notifications on or what plugin I should use to receive these notifications that would be greatly appreciated.


Category Name with Custom Post Type

Hopfully I can explain this, I'm confusing myself now. I have Template called 'Landing' that is the template for a number of different pages in Wordpress. Each of the pages using this template will contain different blocks of information. These blocks contain a title, an image, text and a link, I'm calling them Content_Widgets, they are not Widgets in the Wordpress sense. My Content_Widgets are each posts and I have created a custom post type called Content_Widget. Now I need to load the correct posts on the correct page. I thought I could do this by having a category on the page in Wordpress and then the same category on the post for that page. So it would be like load the post that have a category the same as this page. Is this a good way to load the correct post on the correct page? So this is the code I'm using but it's not outputting anything.(I'm using Advanced Custom Fields in the Custom post type.) The correct category name outputs in the h1 but nothing else. Anyone have any ideas why this isn't working, or is this the wrong way to do this??
                      <?php                                         // get category name for page                     $cat = get_the_category($post->ID);                     $catName = $cat[0]->name;                     echo $catName;                          $content_args = array(                         'post_type'         => 'Content_Widget',                         'category_name' => $catName                                      );                          $content_loop = new WP_Query($content_args);                          if($content_loop->have_posts()):                         while($content_loop->have_posts()):                             $content_loop->the_post();                          $linkImg = get_field('image');                     $txt = get_field('text');                     $link = get_field('link');                      ?>
<?php echo $catName;?>

<?php the_title(); ?>

<img src="<?php echo $linkImg; ?>" alt="">

<?php echo $txt; ?>

<a href="<?php $link; ?>">Find out more

                           <?php                          endwhile;                     endif;                          wp_reset_postdata();                      ?>


Menu System: Custom Links

Is there a way to set default values for options selected in the WordPress menu system? My example would be if the "Custom Link" option was chosen, can this default to a _blank target? Thanks!


wordpress 3.4 template files in subdirectories

i've been organizing my sites template files into a sub directory, which is now possible with wordpress 3.4. but when i move a custom post-type single file (ie. single-news.php) into the sub directory, it is not recognized. anybody have any experience with this new feature?


Individual page data in one page template

So I am trying to create a one page template but still allow the user to add separate pages in the admin panel. What I did to output all the pages in one template file is as followed:                   <?php         $args = array(             'sort_order' => 'ASC',             'sort_column' => 'menu_order'         );         $pages = get_pages($args);         foreach ($pages as $page_data) {             $title = $page_data->post_title;                  if (has_post_thumbnail($page_data->ID) {                 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $page_data->ID), 'full');             }             $section .= '
;             $section .= $thumbnail[0];             $section .= apply_filters('the_content', $page_data->post_content);             $section .= '
                  echo $content;         }         ?>      Now this nicely outputs 3 `<section>` tags with the page title as their `id`. But whenever I try to grab data like the `page-thumbnail` or a custom meta box data for video embed, it will return that thumbnail inside all `<section>` tags. Each `<section>` should function as their own `page` and grab their respective data. Am I doing something wrong?


Redirect page to default subpage

On a site that I'm working on I have a particular page that has four subpages, which act like process steps. I want the parent page to always redirect to the first of these as a default, should the user type in or click on a url that only points to the parent page. Is there a way to accomplish this without the use of mod_rewrite? Thanks in advance.


localize inline css

I'm providing a theme setting to define a group of images for the frontpage background. On page load, I want to pick an image at random from this pool. My approach is to add a line of inline CSS styling the html element with the given image url like this:               <style>       html {          background: url(images/random_image_3.jpg) no-repeat center center fixed;          -webkit-background-size: cover;         -moz-background-size: cover;         -o-background-size: cover;         background-size: cover;       }     </style>      Is there a preferred way of doing this ? Should i use a localize_style function I haven't found out about, or just echo the css out using the right hook? And what's the best hook for this, only targeting the front facing site?


How to add custom text editor in add post section?

How can I add custom text editor in wordpress? Is there any way to do that? If not, How can I add or remove certain features from it? Thanks in advance.


When does next Cron Job run (time from now)?

I would need to know how much time is left between _now_ and the next time a specifc Cron Job is done. For another answer I built a basic cron inspector plugin which can be found here. Reason I'm asking is that I'm already that wasted from working that I can't think straight at the moment. :/ Thanks in advance.


How to check if current page is a parent item or child item in a given menu

I'm trying to build a submenu into my theme, and I've got it working except it shows even on top-level pages that don't have children. How could I check that the current page (or current menu item) is either a parent or a child item (I'm pretty sure that logic holds up) in a given menu? At the moment I'm trying to do this check outside of the menu function, because it has wrapper divs and a title that I won't want to show at all in cases where the page isn't a parent or a child. However, if the best answer to my problem is to output the whole thing via a custom walker I'm open to how that might work too. Thanks in advance. Edit: I've gotten a bit further but am now stuck, I can capture the submenu as a variable, but I can't do the check "If there's nothing in the submenu, show nothing". In the below code, `$submenu` doesn't return false when there are no items even with that `fallback_cb => false`.               $main_menu_id = 2; // Change to the main menu id for this install     $top_menu_id = 4; // Change to the top menu id for this install     $in_menu = '';          // Check what menu the page is in, if any     if( coepio_is_in_menu( $main_menu_id ) ) {         $in_menu = 'main-nav';     } else if( coepio_is_in_menu( $top_menu_id ) ) {         $in_menu = 'top-nav';     }          // If the page is in a menu...     if( $in_menu != '' ) {              // Capture submenu as a variable         $args = array(                      'theme_location' => $in_menu,                     'echo'           => '0',                     'sub_menu'       => true,                     'falback_cb'     => false             );         $submenu = wp_nav_menu( $args );              // If the menu has items         if( $submenu ) {             echo 'Menu is good to go';             ?>

In This Section

                         <?php                          echo $submenu;                          ?>

             <?php         }          }      You may have noticed that `'sub_menu' => true` in the `$args`. Here's the code that handles that, taken from another SO post.               // Submenus - required for the submenu (above) to work     // filter_hook function to react on sub_menu flag     function coepio_submenu( $sorted_menu_items, $args ) {       if ( isset( $args->sub_menu ) ) {     $root_id = 0;          // find the current menu item     foreach ( $sorted_menu_items as $menu_item ) {       if ( $menu_item->current ) {         // set the root id based on whether the current menu item has a parent or not         $root_id = ( $menu_item->menu_item_parent ) ? $menu_item->menu_item_parent : $menu_item->ID;         break;       }     }          $menu_item_parents = array();     foreach ( $sorted_menu_items as $key => $item ) {       // init menu_item_parents       if ( $item->ID == $root_id ) $menu_item_parents[] = $item->ID;            if ( in_array( $item->menu_item_parent, $menu_item_parents ) ) {         // part of sub-tree: keep!         $menu_item_parents[] = $item->ID;       } else {         // not part of sub-tree: away with it!         unset( $sorted_menu_items[$key] );       }     }          return $sorted_menu_items;       } else {     return $sorted_menu_items;       }     }     add_filter( 'wp_nav_menu_objects', 'coepio_submenu', 10, 2 );


change recent posts based on category

I am writing a code to display the recent posts of different categories. On clicking category 1, I want to display the recent posts from cat1 and on clicking cat 2 the recent posts from cat2 and so on. The code I have written was displaying the same posts on **all** cats. What should I do?                <?php       $rPosts = new WP_Query();     $rPosts->query('showposts=4&category_name=category1');          while ($rPosts->have_posts()) : $rPosts->the_post(); ?>
POSTS FROM THIS CAT

<?php the_post_thumbnail(array(300,221)); ?>

<?php echo get_the_title();?>

<a class="btn btn-white" href="<?php the_permalink(); ?>">Read Full Story
          <?php      endwhile;      ?>


Accidentally deleted active_plugins portion of the wp_options DB table

Ok, so I'm pretty sure I'm screwed here, because I do not have a database backup, but I figured I'd ask just in case. Within PhpMyAdmin, I meant to just go to the wp_options table and empty out active_plugins portion of this table due to not being about to login because of a plugin error. Well I hit the delete button instead of just emptying it out. Is there any way I can manually add in the active_plugins part of this table? I tried the repair database thing, but that didn't work.


Display posts count in front of the tag, for each tag

I needed to list all existing tags so I have some code that does it. Now I would like to put the count (the number of posts the tag is associated with) in front the tag like in the example given below.                   first_tag  - 18         second_tag - 24         third_tag  - 48      I found a solution given here that displays count for **one** specific tag, but I need the counts for **each and every tag**. So, could this be modified to my need. Or do you have any other ideas. Will appreciate your help.               $taxonomy = "post_tag";      $term_slug = 'some-tag';     $term = get_term_by('slug', $term_slug, $taxonomy);     echo $term->count;


Resource Issues: Importing external data into custom post type and keeping records up to date

I have a custom post type that imports external data nightly. When the import script runs for the first time, it imports approximately 4,000 records (data will grow). Each record consists of a post title, body and 15 additional meta fields. After the import has run at least once, all subsequent nights it updates at least one meta field from each record to indicate that the record existed in the external data set and that it is up to date. The external data contains a modified date field which indicates when a record has changed outside of WordPress. If the import script detects that a record changed, it will update all fields. At the very end of the import, an internal script will look at all records and find the ones that didn't update. If a record didn't update, a delete flag is set and the published status is changed. Eventually that record is deleted. Lastly, each record can be overwritten in WordPress, which sets a flag that this post should not be updated during an import. This was one of the reasons why we decided to place them in a custom post type, as it provides data control before the record is displayed on the site. I'm using `wp_insert_post` to insert and update records, `update_post_meta` to insert and update meta fields, a `WP_Query` to get all current and expired records, and eventually I delete the records that need to be deleted with `wp_delete_post` and `delete_post_meta`. The problem is that this script is too resource intensive to run and eventually WordPress will timeout and not complete the script. I figure I have two options:   1. I break this script into batches. For example, I could process 1,000 records at a time and store an index so that it would know where to pick-up during the second iteration.   2. I could try using different functions. For example, during the initial import, I run `update_post_meta` once per field (15x). I could probably find a way to make that one query via a custom query. My question is if anyone has ever run into resource issues in WordPress when synchronizing data with an external source, and how they've managed to mitigate those issues. Was it via option #1, #2 or perhaps an entirely different method?


Does Wordpress has an automatic link parse function?

Does wordpress has an automatic link parse function? I want the HTML to be generated automatically when writing               www.url.com -> www.url.com


Custom links or pages from Media Gallery

I have a simple Wordpress Media Gallery running on a page and every time you click an image it takes you to the attachment page. This is fine as I can write an article in the description and that page will contain text and the main image. The issue is I would like each image to have it's own article/post on my website. As I look at it there are two solutions I can see, but I may be missing something. 1) Use the attachment page as the article and somehow get WordPress to use these as posts. 2) Set a custom link in the gallery so that it links to an actual article. Neither are brilliant and I would like to know if anyone knows of a better way to accomplish this. Any advice and help would be greatly appreciated.


Suggestions for allowing basic users to view their own posts?

I have a client that needs to give access to her clients certain documents. She wants the ability to give them user name and password, so once they log in, they go directly to their page or post which will list the documents available for download. Plugins don't seem to help here and some are way too complicated. I have read many articles and tried several concepts but can't get it right. It's almost a membership to access info, but it's free and members can only be allowed to see what was written for them. This is a tough one for me. Any suggestions?


Using plus (+) sign insread of space (-) in WordPress URL

How to change space (-) sign to plus (+) sign in clean URL WordPress? Like: `http://www.whitelotuscorporation.co.in/anax_wp/about-us/` to: `http://www.whitelotuscorporation.co.in/anax_wp/about+us/` You can see where the change need to be done-- `about+us` instead of `about- us` in the URL.


Memory consumption in w3-total-cache vs wp-super-cache?

I've been suggested by my hosting to move from w3-total-cache to wp-super- cache since the later is supposed to be using less memory then the first. Is there any knowledge about this comparison? Is there a way to test it on my own site? (I am on a managed VPS) Thanks.