How to query the custom fields by language?

For each post, there is a custom field name "Function", the key/value pair is like this:               Key : Functions     Value : <!--en-->Nourishing Yin and invigorating the vital essence of kidneys.<!--:--><!--tw-->滋陰補腎。<!--:-->      The problem is if I simply use get_post_meta , it return string of both language, how can I get the value based on the language? I am using qTranslate right now, Thanks.


Get Page content to displayin Bootstrap Modal

Ok I'm a relative novice here, and after looking around I still haven't found the answer to my problem. I'm basically trying to link a Bootstrap Modal to some text in a footer (widget), the content of which is sourced from a Page. I started by placing ALL the text + code in an HTML text widget, but that was too messy (as there's a fair bit of text to include), and have been checking out some other questions like: http://stackoverflow.com/questions/16347865/wordpress-page-content-in-modal- pop-up and Open WordPress Posts in Bootstrap Modal I hope this makes sense. I have so far been developing my own theme from Bootstrap and figured out much already, but haven't found an answer to this yet. thanks in advance


Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do not know to get this hook to fire after all of the post_meta for the post has been saved:               function get_some_meta($post) {              $feat_img = get_post_meta($post->ID, 'feat_img', true); // This has not yet been saved, so I can not retrieve it...              // Do something with $feat_img...             }          add_action('save_post', 'get_some_meta', 11, 1);


How do I update WooCommerce template files in my theme?

WordPress beginner here - my site seems to have some outdated template files which I think are the cause of some functionality issues the site is experiencing. Particularly, there are bundled outdated template files for the plugin WooCommerce. As far as I can tell, this is a fairly common problem for this plugin and they've even created a 'system status' page to show you exactly which template files are out of date. Looking at this system status, I can clearly see that the template file 'variable.php' is out of date. This matches a problem I'm having where items aren't being added to the cart. Now I'm fairly new to WordPress but if I understand right from this article, these template files are just that - templates. They're all the same with slight revisions in each version, and I need to copy the actual contents over from my variable.php file over to the newly updated variable.php. But then the article goes on to say this: _"If you’ve found templates that are outdated you need to copy over the new templates to your theme and then make any changes you made to the previous template to this new template."_ I've found the templates that are outdated, but where do I find these 'new' updated templates? Is there an online resource that specializes in updating these files? If I'm right about how this works, this question should be easy. If I'm not, please correct me.


migrating local dev site to live site with no downtime

i know the issue of migrating a local dev site to a live site has been discussed extensively, but i'm wondering how to do this without any downtime. i'm working on a local copy of my live site to integrate a new theme. being as some of the theme admin settings are different (upload logo, widgets, menus, templates, etc), i think the only way to make these changes final are after migrating my site, so i'm thinking i'll have to upload my new theme when i'm done with the local version, and then rush to change the admin settings after the fact on my live site. previously, i've done this by creating an additional wp install on my live server, made all final changes, and then pointed the top level domain to the new install. i'm unable to do it this way based on how the hosting & domain is setup @ this hosting (the domain is managed by a 3rd party, and it may take a few days for them to point the domain to a new server - honestly i don't even want to have to deal with this with them). wondering if there is another way to do this? or something i'm missing? thanks everyone!


search also in taxonomy, tags and custom fields

I have found many answers separately for Taxonomy, Custom fields and Tags, most of them outdated. But how to combine a search in:               - designed custom fields of a custom post     - custom taxonomy terms     - Tags     - Title (already by default)     - Content (already by default)      One of my custom items could be for example:               item 1     tag: tag1, tag2, tag3     taxonomy: tax1, tax2     custom field 1: cf1     title: composed title 1     desc: a full paragraph with many words      Now I would like to be able to search for :               "paragraph tag2 cf1 composed"      The solution seems incredibly complicated... is it only possible with a new SQL query (`JOIN LEFT` etc) of can I find my way with simple `$query->set()` ?               add_filter( 'pre_get_posts', 'cjg_theme_filter' );          if (!function_exists('cjg_theme_filter')) {         function cjg_theme_filter( $query ){              if ( $query->is_main_query() ){               //is_search is necessary for custom taxonomy urls             if ( $query->get( 'tag' ) OR $query->get( 'artprim_categories' ) OR is_search() )                 $query->set( 'post_type', array( 'post', 'artprim_item' ) );                  if ( is_search() ){                 $queryString = $query->query_vars['s'];                      $queryTab = explode(' ', $queryString);                      $meta = array();                 foreach($queryTab as $queryString){                     $meta[] = array(                         'key' => 'date',                         'value' => $queryString,                         'compare' => 'LIKE');                 }                 $query->set( 'meta_query',$meta );             };                 }              return $query;          }}


Second completely independent and disposable Wordpress installation in subdirectory?

I know this may have been asked before, but I didn't find an exact answer, so yeah ... I have a wordpress installation in the main directory of my Webspace (hosted @ Strato) and I want to install a second wordpress installation in a subdirectory that is completely independent from the main Wordpress installation. I need this for testing purposes and about 20 people will have access to the dashboard of this second wordpress installation with admin privileges, so obviously I don't want them to be able to screw anything up in the main Wordpress installation. So here's my plan:   1. I set up a new MySQL database and upload the wordpress installation package to a subdirectory like example.org/test-sandbox/   2. I enter this directory in my browser to install wordpress normally, using the newly created database.   3. I create a new FTP-access that can only access the subdirectory so that I can give out that FTP access without having to worry about my main Wordpress installation. Then I _should_ have a second wordpress installation up and running, that can be accessed and played around with using the subdirectory, without any connection to the main Wordpress blog. Will this work as intended? And if so, three additional questions:   1. Are there any things I have to do to make sure my main Wordpress installation is completely safe? Or any potential error sources I should be aware of?   2. Will the second Wordpress installation be gone for good once I delete the subfolder and the MySQL database?   3. I don't want any pages, posts ot **anything** from the second Wordpress installation to show up on google and the like. Is there a way to mark the entire site as _noindex_ , _nofollow_? Sorry for the exhaustive question, any help is appreciated!


Placing Ads after every 10th Post with Infinite Scroll

I have to load a couple of ads, some normal html and two are java script. I've tried the PHP method of this:               <?php $postnum++; if($postnum%10 == 0) { ?>

           <?php dynamic_sidebar('botad'); ?>

      <?php } ?>      What occurs is for the first pagination from the infinite scroll it will load the add, on the new loaded pages it will no longer load the ads. The Infinite Scroll I am using as follows: Infinite Ajax Scroll


Show posts in category x and y from the 6th most recent post onwards

I'm struggling with the query for this in WordPress to display posts in a category from the 6th most recent onwards. Basically, I have a top 5 posts section at the top of a category for featured posts (marked as posts in that specific category AND in a Featured category), then in the page content I don't want any of those top 5 featured posts shown in the regular posts loop. Any help would be greatly appreciated.               $query = new WP_Query( array( 'category__and' => array( 2, 6 ), 'offset' => 5 ) );


Connect forms in WP to external database

I want to use Wordpress for an existing site (coded in PHP). It has some forms (for member subscription, user can update their data etc.) which are connected directly to an existing database. I don't want to touch or change the DB, because it's a huge member database. So my problem now is - how can I use a contact form within wordpress which sends the data automatically to this existing database? Thanks for your help!!


Bumping a (tagged) post to the top of archives

One of my WordPress sites is a monthly newsletter sent out by a small team to a big organisation that employs over 1,000 people. The main site works well, but I'm working on the archive pages just now. Every month, one article is designated the 'featured post'. It's given pride of place at the top of the homepage. I do this by applying the tag 'featured' to the post. I know there's probably better ways to do this than tags, but I've got 12 non-technical people posting items to this newsletter and this worked for them before custom post types came along. On index.php, I do this:               query_posts(array('tag' => 'featured'));      What I'd really like, is to be able to do this on the archives. I'm trying to get it so that, on the monthly archive page, the post tagged 'featured' for that month shows up at the top, followed by the rest of the posts (as normal). Has anyone else made similar changes to the archive pages before? Google doesn't seem too helpful -- searching for 'wordpress customize archive' just throws up a few CSS tutorials.


multi page password protection

Is it possible to have the "password protected page" feature of WordPress apply to more than one page? I have dozens of pages which I wish to protect with the same password, but I don't want people to keep having to type the password every time they open a new page. I also don't want people to require an account, all they should need is one password!


How to get the input of a TinyMCE editor when using on the front-end?

I'm not sure why I haven't been able to find this, but does anyone know how to get the input of the TinyMCE editor? I am using it in the front end and want to be able to save whatever the user has typed into the TinyMCE to a database but cannot find the best way to capture that value. The two solutions that I've implemented with some success are:   1. `tinyMCE.activeEditor.getContent();` \- This one seems to only get the value of the visual editor so if I'm in the HTML editor and make changes and then save, they aren't picked up.   2. `$('#html_text_area_id').val();` \- This one is the opposite, it only seems to get the value of the HTML editor. I know there is a better way - I just can't seem to find it... p.s Yes, I'm going to implement security measures to make sure people can't blow up the database.


Use main theme's CSS for the outer wrapper in list-category-posts?

All the HTML and CSS shortcode handles are fantastic! I'm able to simply reference my main theme's existing CSS to instantly format the content. What I don't know how to do is formatting the overall list container. How can reference the main theme's gallery CSS and apply a /div class=mygallerytheme/ wrapper around the list? The div needs to sit just above the starting /ul/. (That div also handles the responsive sizing, formatting, etc.)


Custom Post Status Posts viewable to the public

I am using EditFlow's "custom status" feature for an event calendar plugin I am writing for a client. I've created a status called "previous events", when a date has happened the events post_status goes from "publish" to "previous events", as they would like to display previous events. The issue I am facing is that the ALL posts that have post_status in WordPress set to anything other then "Public" don't get shown to people are not logged in when people click on the permalink for that particular post. Does anyone know of a way around this? A hack maybe in WordPress?


Mobile switcher and theme switcher gets conflict

I have used the following plugins for my wordpress, Mobile Switcher and Theme Switcher Also i have the option to view the mobile theme on my site. one can view the mobile view on desktop and again come back to default theme (that is default theme).I set the path using theme switcher plugin. When i ran the site on mobile, i got the mobile view as expected. Now in mobile theme,I have the link to view the desktop theme. When i click the desktop view, Desktop theme could not to be loaded all the time and mobile switcher plugin always force the wp to view the mobile theme. How can i switch back to normal theme even i have mobile switcher plugin. Kindly advice on this?


Action hook load_textdomain $domain variable

I use the `load_textdomain` action hook to list all active localization text domains with corresponding path to translation files.               function mo_location( $domain, $mofile ) {           if ( !is_array($GLOBALS['moloc']) )                 $GLOBALS['moloc'] = array();              $GLOBALS['moloc'][$domain] = $mofile;     }          add_action( 'load_textdomain', 'mo_location', 10, 2 );      For some reason the `$domain` variable is not filled with a "default" text domain values. Does anybody know why?


Echo User Name from User with most comments of today?

Without the date - I'm trying to integrate - the code is working: outputting the user with the most comments. But currently I try to get the user with **most comments of today** but that does not work. What am I doing wrong?                <?php         global $wpdb;         $today = date('Y-m-d');         $tomorrow = date('Y-m-d', time() + 86400);         $where = 'WHERE comment_date >= %s  AND comment_date < %s AND user_id <> 0';         $comment_counts = (array) $wpdb->get_results("         SELECT user_id, COUNT( * ) AS total         FROM {$wpdb->comments}         {$where}         GROUP BY user_id         ", object);         foreach ( $comment_counts as $count ) {         $user = get_userdata($count->user_id);         echo 'http://fragmatisch.de/profil/' . $user->display_name .  '         ';         }         ?>


How do I get all results from my query

I have written some php code and using the class.pagination.php, am able to paginate it based on a max posts per page that I set inside my code. This works great. However, it is only returning 11 posts and I know that I have 186 posts, I am so stuck, any help would be appreciated. here is my code:                  <?php               define  ("WP_USE_THEMES", false);     define  ("MAX_PER_PAGE", 3);          include ("wp-load.php");     include ("pagination.class.php");          //  posts_per_page=-1          $query = new WP_Query(array('post_type' => 'any'));     $posts = $query->get_posts();          $sAllTitles   = array();     $sAllDates    = array();     $sAllContent  = array();     $iCount       = 0;          foreach($posts as $post)      {            $sAllTitles[$iCount] = $post->post_title;            $sAllDates[$iCount]  = $post->post_date;            $sAllContent[$iCount]= $post->post_content;            $iCount++;     }          $iCount = 0;     foreach($posts as $post)      {         $PostData[] = array(         'PTitle' => $sAllTitles[$iCount],         'PDate'  => $sAllDates[$iCount],         'PCont'  => $sAllContent[$iCount],         );         $iCount++;     }          ?>                                        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />     <title>BLOG POSTS</title>                              <?php          if (count($PostData))      {         $pagination  = new pagination($PostData, (isset($_GET['page']) ? $_GET['page'] : 1), MAX_PER_PAGE);         $pagination->setShowFirstAndLast(true);              $PostPages = $pagination->getResults();              echo $pageNumbers = '
'.$pagination->getLinks().'
';              if (count($PostPages) != 0)          {             print("
");                  foreach ($PostPages as $PostArray)              {             print ('
');                 print ('
' . $PostArray['PTitle'] . '
');                      print ('
' . $PostArray['PDate'] . '
');                  print ('
');             print ($PostArray['PCont']);             print ('
');                  print ('
');             print ('
');             }                  print ($pageNumbers);         print ("

");         }     }               wp_reset_query();     wp_reset_postdata();               ?>


PHP mixed with some JS code to update Wordpress theme settings

I am working on my first Wordpress Theme but I am facing a little problem in my code. In fact, I have created a little page in the administration to change some settings on my theme and, for example, to modify the background images of the theme which are displayed in a slideshow jQuery plugin called `"Vegas"`. All works well but I think that I don't really use a good method to implement my code. In the header.php file, I have written this :                       <?php             if(get_theme_option("bg_slideshow") == 1):             ?>             /* Background Images */             var bg_slideshow = jQuery(".bg_slideshow").attr("data-active");             if(bg_slideshow == 1) {                 jQuery.vegas('slideshow', {                     delay: 8000,                     backgrounds:[                         <?php echo get_bg_images_url(); ?>                     ]                 })('overlay');             }             <?php             endif;             ?>      As you can see, I have some PHP and some JS code mixed here... So I get the theme option with a PHP function and I updated my JS code like that. Can anyone help me to improve my code or can anyone tell me how I need to work (or to separate the code) in order to have something good ?


Manual display of widget

I currently have a widget that needs to be manually displayed on the front page. The rest of the pages it shows up in the widget sidebar, (this is accomplished with 'Widget Logic') but on the front page I need it to display in a different area. I tried using the_widget() but the issue is that it doesn't display any of the saved data for the widget. How can I manually display the widget and get my saved data for the widget to display? **SOLUTION:** This is the code that ended up solving my problem. Basically you can retrieve widget data using get_option. I did a var_dump of the result and found the array that I wanted and fed it back into the_widget function. I guess the only issue here is if a user ever deletes the widget and remakes it, the array key will most likely change. But it works for now.               if(function_exists('the_widget')) {     $instance = get_option( 'widget_backspikewidget' );      the_widget('BackSpikeWidget', $instance[2]);     }


Ajax call in wordpress not working for subscriber user

All In my application there is notification system, when user click on that icon I want to make ajax call. The problem id it works fine for admin user (Debug : 200 ok), but not for subscriber user (Debug : 301 moved permanently). Ajax call               $("#notifications-button").click(function() {                   $.ajax({         type : 'POST',              url: '<?php echo get_option('siteurl') . '/wp-admin/admin-ajax.php' ?>',         data:'action=my_special_ajax_call&value=1',         success : function(data){             $('.message-count').hide();         },              });     });      Function                function implement_ajax() {          if(isset($_POST['value']))       {              global $wpdb, $user_ID;              $wpdb->query( $wpdb->prepare("UPDATE wp_frm_items SET alerts_flag = 0 WHERE user_id = '". (int)$user_ID ."'" ));     }     }     add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');     add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.      I do not able to get why this not working for subscriber? Is there anything wrong in code? Thanks In Advance !


How do i add class="fancybox" to the default gallery?

i tried this shortcode: > [gallery class="fancybox" link="file" columns="5"] But the class="fancybox" isn't been added to the a href tag of each image. How can i add class="fancybox" to each a href tag?? ps: where is the source code of gallery?


how to add datas in taxonomy to post with wp_insert_post this is my code but it is saved in my texonomy draft,why? i have given post_type=publish.                   $my_post = array(             'post_title'    => 'test',             'post_content'  => 'hello',             'post_status'   => 'publish',             'post_author'   => $userdata->ID,             'post_type' => 'Newpostlist',                 );                $post_id = wp_insert_post($my_post);


Show only 2nd level of navigation depending on active navigation

For example, suppose a menu like so:               Parent 1       Child A       Child B     Parent 1       Child C       Child D       Child E     Parent 2       Child F      In a certain part of my template, I want something to show depending on the current "location" in the menu. If the user is on the `Parent 1`, `Child C`, `Child D`, or `Child E` pages, then I want a little menu to show up that says `Parent 1` as the header and the children as the links. I've tried a variety of things (creating a custom walker object, writing css to just not show the items that shouldn't show, etc.) Also, if there are no children at all, then I don't want to display the parent even on the parent's own page. Does this make sense? I don't want a plugin that does/helps with this (I don't like to have my template "depend" on a plugin)


Why is my menu order not working with wp_nav_menu?

I have a custom menu using the new Menu System but it is not returning in the correct order. I have no idea what order its in - its not alphabetical, or by date, or by any pattern I can see. The link is http://www.oia.co.za/. The pages "sponsors", "archives" and "fewtchafests" are supposed to appear as the last 3 items, after the series of numbers, not before them. If the first item wasn't also a number, I might think it was rendering all numbers last, but that first item ("8333") kind of scuppers that idea. Screenshot of correctly dragged-and-dropped menu order attached, screenshot of website displaying wrong order attached, and the code used to call the menu is below. ![correct menu order](http://i.stack.imgur.com/UTvmm.jpg) ![enter image description here](http://i.stack.imgur.com/8xoGj.jpg)                                         <?php                  wp_nav_menu( array(                     'theme_location' => 'advent-calendar',                     'menu' => 'advent-calendar',                     'menu_class' => 'component-calendar',                     'container_id' => 'calendar',                     'container_class' => 'advent',                     'orderby' => 'menu_order',                     'walker'=> new Salamander_Advent_Walker()                     )                  );             ?>                        EDIT: It's definitely a problem with my custom walker (code below) - if I comment out the call to the custom walker function, it generates in the right order:                   class Salamander_Advent_Walker extends Walker_page {             function start_el(&$output, $item, $depth, $args) {                private $color_idx = 1;                      $advent_thumbnail = get_post_meta($item->object_id, 'advent-thumb', true);                 $advent_slug = get_post_meta($item->object_id, 'advent-slug', true);                 $advent_oneliner = get_post_meta($item->object_id, 'advent-oneliner', true);                 $advent_color = get_post_meta($item->object_id, 'advent-color', true);                 $advent_small_title = get_post_meta($item->object_id, 'advent-title', true);                      $advent_title = ( !empty($advent_small_title) ? $advent_small_title : $advent_slug);                      $output .= $indent . '
color_idx.' active">                                                                                '. $advent_slug .'                                                                                '. $advent_title .'                                                                          '. $advent_oneliner .'                                                                                ';                 $this->color_idx++;                 if ($this->color_idx > 4) {                     $this->color_idx = 1;                 }             } // ends function         } // ends class


How should I intercept the main query and inject custom join / order by / group by criteria

I have a CPT that is a member of two separate taxonomies. On the taxonomy archive page for one of the taxonomies, I need to further group and sort on the second taxonomy like so: mysite.com/tax1/term1/ tax2-term1 -post -post -post [see more] tax2-term2 -post -post -post [see more] ... etc. ## Better Example To provide a more easily accessible example, consider the following CPT: Toys. And the two taxonomies: Colour and Age Group. On the taxonomy archive page for mysite.com/colour/red, I need to further group on the second taxonomy, "age group" like so: **Red Toys** Ages: 0 - 12 months -toy -toy -toy [see more Red toys for ages 0 - 12 mo] Ages: 12-24 months -toy -toy -toy [see more Red toys for ages 12 - 24 mo] etc... # Intercepting query_posts So, unless I'm mistaken and we've suddenly got the ability to sort on taxonomy (grouping would be ideal, but I could work around that), I'm thinking that a custom SQL query with my own tax joins will be the best way to get what I need. Correct me if I'm wrong. Most of the time I want to go the built-in WP way, I just don't see that working here. How would you hijack the main query to still use The_Loop(TM) but with custom SQL? Or would you find a way to return an empty query and then just roll your own custom SQL loop? Right now I'm leaning toward using `pre_get_posts` to set up a `posts_clauses` replacement of the join, groupby, orderby and maybe limits clauses, or even a wholesale replacement of the entire request using `posts_request`. Is there an easier way?


Link permalink in Twitter Bootstrap "TypeAhead" results

Twitter Bootstrap have a javascript plugin called TypeAhead which is simular to Google Instant Search. I'm using it to pull the WordPress post titles into the search box, using the following code c/o @StephenHarris               data-source='[<?php          $posts = get_posts( array( 'numberposts' => -1, 'category' => 0 ) );         $post_titles = wp_list_pluck( $posts, 'post_title' );          $post_titles = array_map( 'esc_html', $post_titles );          echo '"'.implode( '","', $post_titles ).'"';     ?>]'      But how would you link the post permalink to the drop-down list of post titles?


Is it OK to move admin menu items?

I have a site with eight custom post types. Each is registered with `'menu_position' => 5` (below the Post menu). A side effect of having more than four CPTs is that the Media menu now appears in the middle of the list of CPTs (see image). ![Admin menu with many custom post types](http://i.stack.imgur.com/dmWyX.png) My solution is to duplicate the Media menu item in a lower position, then unset the original Media menu item:               add_action( 'admin_head', 'change_menu_items' );          function change_menu_items() {              global $menu;              $menu[14] = $menu[10];         unset( $menu[10] );          }      My question is: is this likely to cause any unforeseen side effects? I haven't come across any yet, but just wanted to make sure. Thanks!


How to creat form with get method and receive it

I want to put a form in a page on my wordpress (in local). I have this form code :               <form method="get" action="">
XML name :
         <input type="text" name="xml_id" />         <input type="submit" value="Send" />     </form>      I want to get the `xml_id` in the same page (it's why : `action=""`). I've install Insert PHP plugin to insert this php code :               if (isset($_GET['xml_id']) and file_exists($_GET['xml_id']))         {             $link = 'http://localhost/wordpress/php/XML/display.php?xml_id='.$_GET['xml_id'];             echo 'xml_id : '.$_GET['xml_id'].'
';             echo $link.'
';             $content = file_get_contents($link);              echo $content.'
';         }      But, it doesn't works, and when it works, my page url is : `wordpress/?xml_id=XML`. Or I want something like that `wordpress/?page_id=1&xml_id=XML`. Thanks.


Best way to inject css into admin_head in plugins?

I'm looking for the best way to inject CSS into WordPress' Admin CP. Currently, I'm using the `admin_head` action hook and in this hook, I'm using `dirname( __FILE__ )` to retrieve the directory for the stylesheets. However, `dirname()` does retrieve the server's path. **Is this the recommended way or is there some sort of WordPress function to get a _URI_ path rather than a _directory_ path?**                   public function admin_head()         {             // Let's include the Control Panel CSS             $url = dirname( __FILE__ ) . '/css/cpanel.css';             $ie = dirname( __FILE__ ) . '/css/cpanel-ie.css';                  // Inject our cPanel styelsheet and add a conditionaly for Internet Explorer             //      (fixes bugs on my home browser)             $head = <<<HEAD         <link rel="stylesheet" href="{$url}" type="text/css" media="screen" />         <!--[if IE]>             <link rel="stylesheet" type="text/css" href="{$ie}" media="screen" />         <![endif]-->     HEAD;                  echo $head;                   foreach( self::$classes as $class => $obj )             {                 if ( method_exists( $obj, 'admin_head' ) )                 {                     $obj->admin_head();                 }             }         }      -Zack


update user meta with multidimensional associative array

I am trying to: If a key exists If inner key exists Update value Else, Create key and populate with value Else, Create key and populate with value(inner array) Inner array populate key and value Save to variable update user meta I don't understand how to put the new values into the variable and when to add the new value to the update user meta.               $lastVisits = get_user_meta($current_user->ID, 'lastVisits');     if(empty($lastVisits)){         $lastVisits = array($_POST['canvasObject'] => array($_POST['cameraNumber'] => date('F j Y', current_time( 'timestamp', 0 ))));         update_user_meta($current_user->ID, 'lastVisits', $lastVisits);     }else{         foreach ($lastVisits as $k => $v){             foreach($v as $co => $cn){                 if($co == $_POST['canvasObject']){                     $test = '$co == $_POST[canvasObject]';                     foreach($cn as $n => $val){                         if($n == $_POST['cameraNumber']){                             $val = date('F j Y', current_time( 'timestamp', 0 ));                         }else{                             $val = date('F j Y', current_time( 'timestamp', 0 ));                             $n = $_POST['cameraNumber'];                         }                     }                 }else{                     foreach($cn as $n => $val){                                                     $val = date('F j Y', current_time( 'timestamp', 0 ));                         $n = $_POST['cameraNumber'];                         $cn = $_POST['cameraNumber'];                     }                      $co = $_POST['canvasObject'];                 }             }             update_user_meta($current_user->ID, 'lastVisits', $lastVisits);         }     }


How to look at code in WordPress repositories without downloading?

A lot of questions are about plugins and themes, that you don't necessarily have installed. Downloading zip archive, unpacking and opening in editor seems like a too much hassle. If only there was a way to just browse source of WordPress and all of plugins and themes int its repository...


Custom Maintenance Page

I'd like to create a custom Maintenance Page for my needs, but not only when wordpress is updating. I just want to close my site for a period with all the necessarily status code sent. What is the best way to do it?


wordpress - user registration ( signup registration )

I am working on a blogging website ..! I need to create Signup Registration and allow multiple users to blog on our website. i.e ) Website will blogged by myself and also allows any registered users to blog on our website. In addition we allow any anonymous comments to be posted on the blogs. A registered user can tag / follow their favorite blogs. How to create a Signup Registration on Wordpress Blogging Website and allow any registered users to blog on our website ?


WordPress sharding: which multi-DB plugin to use?

I've got a WordPress multisite installation that's hosting enough blogs I need to shard the database. I see there are three plugins available to spread WordPress across multiple databases:   * http://wordpress.org/extend/plugins/hyperdb/   * http://premium.wpmudev.org/project/multi-db   * http://wordpress.org/extend/plugins/shardb/ I'm trying to decide which one to use, but I haven't really found much info comparing them. Does anyone have experience deploying any of these three tools? Or better yet, experience with more than one of them and a rundown of why you switched? Thanks, Bethany


"wp_editor" not displaying TinyMCE correctly when square brackets used in name

I'm creating a custom options page and I have a textarea that I've turned into a TinyMCE editor using wp_editor. TinyMCE displays correctly, however it breaks when I include square brackets in the $id. Here's the code I'm using for the add_settings_field function callback:               function px_wp_editor($args){             $options    = get_option('theme_options');               $value      = $options['px_wp_editor'];             $id         = 'theme_options[px_wp_editor]';                   extract( $args );              $class = (!empty($class))?$class:'';                   $settings = array(                 'textarea_rows'     => 12,                 'textarea_name'     => $id,                  'editor_class'      => $class,                 'media_buttons'     => true,                 'tinymce'           => true              );              wp_editor($value, $id, $settings );                     }      If I removed the square brackets from the $id value then it displays fine. However, because of the way I'm retrieving the values using get_option, I need to call "textarea_name" as it currently is, with square brackets. The first pic below is how it looks when using square brackets for the name (full icons don't display correctly and there are no Visual/Text buttons. The second pic is how it should display. ![Here's a screenshot of how it looks when using square brackets for the name](http://i.stack.imgur.com/pcUng.jpg) ![Here's how it should look](http://i.stack.imgur.com/cXsKt.jpg)


Use a custom post URL that is outside the blog root directory

I have a website blog and its URL is: www.website.com/blog The above is fine and I want it to stay that way. www.website.com is the main site, which is not a blog. Currently, the URL structure for a blog post is: www.website.com/blog/category/post-title-here Is it possible to make the blog posts have a URL structure like this (so it is not after /blog)? **www.website.com/category/post-title-here**


How to create another version of my site based on the same database

I have created a site and would like to create another version of the same site using the same exact database (db location, users, everything). The two sites would share one database. I already have one site created and wanted to know how feasible it is to do, and instructions on how to do it. Currently, the site up now is for consumers and the other version will be for corporate clients. Please give me some advice on how to do this. The site is: www.savingsulove.com Thanks a lot for the help.


How do I retrieve an array from wp_postmeta with get_post_meta?

I have got an array stored in the wp_postmeta table. It is has a meta_key of ` custom_repeatable ` It has a post_id of 6. How do I retrieve this & echo it? I think I have to use the following, but it isn't working: ` $item = get_post_meta($post->ID, custom_repeatable', false); echo $item; ` My array has two names stored in it currently (just learning) My Question: How do I retrieve the stored array & echo it?


Check if meta_key exists in wp_list_pages

I have added a custom field (using Advanced Custom Fields plugin) to a page allowing you to show/hide it with a simple checkbox, i want to filter out these pages if a user is not logged in so i am doing the following:               if( !is_user_logged_in() ):       $args = array(         'title_li' => '',         'meta_key' => 'private',         'meta_value' => 0       );     else:       $args = array(         'title_li' => '',         'meta_key' => 'private',         'meta_value' => 1       );     endif;          wp_list_pages($args);      So i want it to show all pages where the custom variable is 0 is not logged in and 1 if they are. Logged in, works fine. Only shows the private pages in the menu. Not logged in, shows all pages no matter what the value is. I have tried adding `meta_compare` and also changing `meta_value` to `meta_value_num` but neither have worked.


Add post title as alt tag for featured image

How do I add post title as alt tag in a post? I tried using array(title => `'.the_title.')` but it didnt work. I think I am not suppose to use `the_title`. I tired using `get_the_title` as well. Thanks


How can I do a url redirect to include a wordpress username?

I currently have a button like this, that takes a user to their 'mentions' page               <a href="http://my.url.org/mentions/<?php global $userdata;     get_currentuserinfo(); echo( $userdata->user_login );?>">button      What I'd like instead is that a user can see their 'mentions' when they log in to the page. so I'd like admin to be redirected to http://my.url.org/mentions/admin when he goes to a particular page (i.e. the homepage) - I think this would be best using a PHP redirect? How could I do this?


Repeatable custom meta fields

I am working on creating custom meta boxes for the back-end of WordPress. I would like to add a metabox with several fields, in my case an image upload and a text input, but with a button that can duplicate both fields. I've been following this tutorial and it works fine. But since I want to duplicate multiple fields (as mentioned earlier, the media uploader and text input), the above tutorial does not quite fit. There is only 1 input text used. Now I have found the following source code, which corresponds somewhat to my wishes: https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes This makes it possible to have multiple cases in a repeatable field stop (this is what I want), only the code is far too extensive and is in a PHP class. Now I want this code into that of the tutorial, just try and get this to many trials for each other. Now I wonder if anyone can help me with this. I've tried many things and work to date yet. When I see the source code, I do not really need the piece and there will be more redundant than necessary. I've also tried the simple case repeatable to copy / paste, but I get errors, including that some variable does not exist. (These are, as I see it also hell once declared nowhere ...) Unfortunately gives these errors are, as I said, namely:               Notice: Undefined variable: repeatable_fields in on line 117      Warning: Invalid argument supp song for foreach () in          customers/0/d/a/xxx/httpd.www/wordpress/wp-includes/functions.php on       line 2638      Warning: array_filter () Expects parameter 1 to be array,       null Given in /file/ on line 118      Notice: Uninitialized string offset: 0 in on       line 138      Code can be viewed at: http://snippi.com/s/xpwucxg How can I duplicate multiple fields?


Set post date before 1970

I have a custom post type called books. The books publication date is from between 1700 and 1900. I want to set the post date to these dates(so i can query the results sorted by year) but i can't seem to have a date set before 1970 january 1. Is it possible to somehow do that?


Share media among different domains

I have multiple Wordpress instances that live on separate domains ( **not** a multisite installation). Since they provide the same content in different languages I'd like to share the images among these instances. Ideally these Wordpress installations would share the same Media Library so that I have to upload the files only once and they would be available on the other site as well, even served by the same CDN and sharing the same URL. So for example I upload `Image1.jpg` on site `Example.com` and this gets copied to the CDN by W3 Total Cache which serves the image from `MyCdn.com/static/Image1.jpg` The other site `Esempio.it` would have the `Image1` already available in the Media Library without needing to upload it and be able to serve the same image from the same URL `MyCdn.com/static/Image1.jpg` Since both sites live in the same server I was thinking of using the `Store uploads in this folder` setting from `Media Settings` and have that target folder be in fact a symlink. What's the suggested best practice for this scenario? The space needed is not a real concern but I was more concerned by ease of maintenance. Thanks!


How to list all tags as radio buttons in a meta box?

I tried to search this issue but I never found anything.. I'd like to put in `post-new.php` admin page a list of tags (all tags present in the blog) as radio buttons. How can I do that?


Why would this code work locally but break online?

For some strange reason this code works perfect on my local installation of Wordpress yet when I put it live on a web server the code just repeats the same two articles over and over again and doesn't progress beyond the same two articles. I'm using InfiniteScroll (not the WP plugin, my manual installation of it). Is there anything wrong with my loop? **EDIT** Here's the link to code in full taken from single.php: http://pastebin.com/dtiSHUYP
                               <?php // Show all posts within this category                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                     $args= array(                         'category_name' => $cat->slug,                          'paged' => $paged,                         'cat' => '-12',                         'posts_per_page' => 2,                         'post__not_in' => array( $post->ID )                     );                     query_posts($args); ?>                          <?php $current_post_date = $post->post_date; ?>                          <?php if( have_posts() ) : while ( have_posts() ) : the_post(); ?>                          <?php if ($post->post_date < $current_post_date) {  ?>

                                <?php                               $image_link=get_post_meta($post->ID,'Image_Link',true);                               if($image_link != '') {                               echo ''. get_the_post_thumbnail() .'';                               } else {                               echo get_the_post_thumbnail();                               }                           ?>
                                 <?php                                 // Call in the contents of a custom field called Credit and if custom field in admin panel is empty don't display
 tags otherwise wrap contents of custom field in
 tags                                 $credit=get_post_meta($post->ID,'Credit',true);                                 if($credit != '') {                                 echo '
'. $credit .'
';                                 } else {                                 echo ' ';                                 }                                 ?>

                              <?php                         $sub_title=get_post_meta($post->ID,'subtitle',true);                         if($sub_title != '') {                         echo '
'. get_the_title() .' / '. $sub_title . ' / ' . get_the_time('l jS F') .'
';                         } else {                         echo '
'. get_the_title() .' / ' . get_the_time('l jS F') .'
';                         }                         ?>                              <?php the_content(''); ?>
                             <a href="#post-<?php the_ID(); ?>" class="comments scrollto">Comment

                                              <a href="https://twitter.com/share" class="twitter-share-button" data-text="<?php the_title(); ?>" data-url="<?php the_permalink(); ?>" data-via="kettlesyard" data-related="kettlesyard" data-hashtags="kettlesyard">Tweet

                                         <a href="http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>" class="pin-it-button" count-layout="horizontal">

                                      + Share

                                   <?php if ( in_category( 'contact' ) ) : // Display nothing ?>                                  <?php // Else, show comments                             else : ?>                                      <?php global $withcomments;                                 $withcomments = 1;                                 comments_template(); ?>                              <?php endif; ?>
                            <?php } ?>                                         <?php endwhile; ?>
<?php next_posts_link(); ?> <?php previous_posts_link(); ?>
                                         <?php endif;  wp_reset_query(); ?>


Getting category before saving post

I am using the filter "wp_insert_post_data" to decide what to save to the database. I need to know which category has been picked before saving the post. How can I get to know the category that has been picked while using that filter? Is there a $_POST["category"] like variable or category object accessible at this phase?


How to get the nivo slider to show excerpt

I'm trying to embed the nivo slider into a wordpress theme so each slide shows a set of recent image pots and excerpt. At this moment I can get it to show the images but not the post excerpt.
     <?php $my_query = new WP_Query('showposts=5&category_name=featured'); while ($my_query->have_posts()) : $my_query->the_post(); ?>      <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">     <img src="<?php echo get_post_meta($post->ID, 'nivoimage', true); ?>" alt="" title="<?php the_title(); ?>" />          <?php endwhile; ?>

       Ideally I'd like the excerpt to wrapped in a div so I can style it in css. Does anyone have any ideas? I should maybe also mention that I'm using the mimbo theme and that doesn't want to accept any kind of news slider plugin. Thanks, * * * _Editors Note: Links to template pastes and such:_   * index   * header   * `get_template_part();`-slides


Only show image from custom field when present

How would I adjust the following code to only show the image tag when there is a variable present in the "imageembed" field?               <?php $imageid = get_post_meta($post->ID, 'imageembed', true); ?>
<img src="<?php echo wp_get_attachment_url( $imageid ); ?>" width="640" />


Duped WP Site - tim thumb uses abs url from prev site

I am duping a wordpress site to split them to 2 similar but diff sites. The original site is working. Latest WP and Theme. On dupe site, with Firebug, I get this for thumbs: .../themes/dandelion_v2.6.3/functions/timthumb.php?src=http://www.avrdev.net/wp- content/uploads/2011/05/PostP-4.jpg&h=130&w=195&zc=1&q=80" style="opacity: 1;"> If in Firebug, I remove the "http://www.avrdev.net" (original site) the thumb appears. How do I get tim thumb to use a relative URL v the (old) Abs url? =Alan R.


How to customize `Edit-Post` Screen

I have found `edit-form-advance.php` in /admin/ that contain layout of edit- post page Have any way to customize layout via `add_action();` ? because I didn't want to edit directly within Wordpress admin file. ![enter image description here](http://i.stack.imgur.com/pJZLO.png)


Stop wordpress from sending out moderation emails

This question was originally posted at stackoverflow: http://stackoverflow.com/questions/11435952/stop-wordpress-from-sending-out- moderation-emails but after a tip from @MaxGherkins I'm posting a modified version here also for help. I'm having trouble with my wordpress installation sending out emails to the site admin _every time_ a comment is up for moderation.   This also goes for spam comments which results in the site admin getting alot of junk emails in his inbox. Every time I google this problem I end up with the answer "Just go to Settings -> Discussion and unclick 'A comment is held for moderation'" but unfortunately this is not helping me. So, here are my settings (some of these may be irrelevant):   1. I'm using wordpress' built in comment-system. No disqus or facebook comments.   2. I've installed the Akismet-plugin. I did try to disable the plugin, but I still get the emails.   3. Both "Anyone posts a comment" and "A comment is held for moderation" is NOT checked under "Settings" -> "Discussion" -> "E-mail me whenever" on the sites.   4. You do not have to be logged in to write a comment   5. The WP installation is originally a Wordpress MU installation, but I've upgraded to 3.x so it's now build into the regular wordpress installation. The installation run many blogs with different domain names and the problem occurs on all blogs AFAIK.   6. Most of the blogs are using the "Yashfa BRANDED!" theme   7. Some information from the database: All blogs are in the same database, prefixed with wp_X_ Here are some output from some random blogs:              mysql> SELECT * FROM wp_1_options WHERE option_name LIKE "%notify";     +-----------+---------+-------------------+--------------+----------+     | option_id | blog_id | option_name       | option_value | autoload |     +-----------+---------+-------------------+--------------+----------+     |        10 |       0 | comments_notify   |              | yes      |      |        32 |       0 | moderation_notify |              | yes      |      +-----------+---------+-------------------+--------------+----------+     2 rows in set (0.01 sec)          mysql> SELECT * FROM wp_50_options WHERE option_name LIKE "%notify";     +-----------+---------+-------------------+--------------+----------+     | option_id | blog_id | option_name       | option_value | autoload |     +-----------+---------+-------------------+--------------+----------+     |        11 |       0 | comments_notify   |              | yes      |      |        31 |       0 | moderation_notify |              | yes      |      +-----------+---------+-------------------+--------------+----------+     2 rows in set (0.00 sec)          mysql> SELECT * FROM wp_100_options WHERE option_name LIKE "%notify";     +-----------+---------+-------------------+--------------+----------+     | option_id | blog_id | option_name       | option_value | autoload |     +-----------+---------+-------------------+--------------+----------+     |        10 |       0 | comments_notify   |              | yes      |      |        30 |       0 | moderation_notify |              | yes      |      +-----------+---------+-------------------+--------------+----------+     2 rows in set (0.00 sec)      The moderation email looks like this: * * * Subject: [SITENAME] Please moderate: "Test spam comments" * * * Body:               A new comment on the post 78 "Test spam comments" is waiting for your approval          http://url/test-spam-comments/          Author : djqw21208ryfg23 (IP: XXX.XXX.XXX.XXX , XXX.XXX.XXX.XXX)       E-mail :     fweuh3298f9wefg923g329@jkg23ru89g9werhj239r8h238t923.asdfhio       URL    : http://feg239r239f9fg7329rfg322379fg23f3       Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=XXX.XXX.XXX.XXX               Comment:       ugly spam comment goes here...               Approve it: http://url/wp-admin/comment.php?action=mac&c=XXXXX       Delete it: http://url/wp-admin/comment.php?action=cdc&c=XXXXX       Spam it: http://url/wp-admin/comment.php?action=cdc&dt=spam&c=XXXXX       Currently 0 comments are waiting for approval.             Please visit the moderation panel:     http://url/wp-admin/moderation.php      * * * Why do I keep on getting these emails even though I've turned off the email- settings under "Settings" -> "Discussion" and it looks right in the database? I've been testing with the blog that belongs to the wp_1_* tables.


Why doesn't my contact form work?

My contact form is here http://wordswithfriends.net/?page_id=124 When users submit a message, I receive an e-mail but the spinning waiting sign keeps on spinning and the user does not receive confirmation. What is wrong with the code?


Use wordpress search to display results within a post

I want to have to display related post within a post based on the post title. So for example I have a post named "France gas prices". First it displays all the post info but then under the post I want to have search results displayed using the "france gas prices" value. Now I could use this. (example search on specific meta data but i would be happy if it just searched post title)               <?php $title = get_the_title() ?>     <?php query_posts('meta_key=review_type&meta_value=$title');  ?>      <?php if (have_posts()) : ?>      <?php while (have_posts()) : the_post(); ?>      And then display the info from the found posts as I want but the problem is then I will only find exact matches. It wont find gas prices france or any other result like wordpress build in search would give. How can I access the build in wordpress search give it a term dynamicly based on post title and then choose what I display from the found posts and how I display the info? \---> in other words how do you the build in wordpress functionality to fill a wp_query?


the_tags without hyperlinks?

How can I call the_tags as a list without hyperlinks?


Why would Wordpress use 'attachment' in a custom post type's query string? Albeit I have a slightly contorted structure in place, I can't seem to find where 'attachment' comes into play and how to change that behavior. My custom post type 'fb_entry' has the custom taxonomy 'issue'. Posts from 'fb_entry' are rewritten with the slug 'journal/%issue%' where %issue% is the term name. I also have a second custom post type called 'fb_issue' whose posts are rewritten with the slug 'journal'. There is also a page with the slug 'journal'. Here's how this is intended to work:   1. User visits /journal   2. User browses list of posts from fb_issue and makes selection   3. User is taken to /journal/fb_issue   4. Here, user browses list of posts from fb_entry with 'issue' terms that match the fb_issue slug   5. User makes selection and views chosen post from fb_entry   6. Ideally, user has URL /journal/issue-term-name/fb_entry-post-name This all seems to work fine until the final step whereat the user reaches a 404 page. Debug Toolbar tells me that the request is:   * /journal/issue-term-name/fb_entry-post-name But the query string is:   * attachment=fb_entry-post-name However, none of my queries call for attachments. **EDIT** Here's the post type registration. Standard, I think: Standardly, I think:               /* Create the 'Entry' post type */     function create_fb_entry(){         register_post_type( 'fb_entry',             array(                 'labels' => array(                     'name' => 'Entries',                     'singular_name' => 'Entry',                     'add_new' => 'Add New Entry',                     'add_new_item' => 'Add New Entry',                     'edit_item' => 'Edit Entry',                     'new_item' => 'New Entry'                 ),                 'public' => true,                 'rewrite' => array(                     'slug' => 'journal/%issue%',                     'with_front'  => false,                 ),                 'supports' => array(                     'title',                     'editor',                     'excerpt',                     'page-attributes',                     'revisions',                     'thumbnail'                 )             )         );     }     add_action('init', 'create_fb_entry');          function create_fb_entry_issue() { /* Create the 'Issue' taxonomy */         $labels = array(             'name' => _x( 'Issue', 'issue' ),             'singular_name' => _x( 'Issue', 'issue' ),             'search_items' =>  __( 'Search Issues' ),             'all_items' => __( 'All Issues' ),             'parent_item' => __( 'Parent Issue' ),             'parent_item_colon' => __( 'Parent Issue:' ),             'edit_item' => __( 'Edit Issue' ),             'update_item' => __( 'Update Issue' ),             'add_new_item' => __( 'Add New Issue' ),             'new_item_name' => __( 'New Issue' )         );                register_taxonomy( 'issue',             array( 'fb_entry' ),                 array(                 'hierarchical' => true,                 'labels' => $labels,                 'show_ui' => true,                 'query_var' => true,                 'rewrite' => array(                      'slug' => 'issue',                     'with_front'  => false                 )             )         );     }     add_action( 'init', 'create_fb_entry_issue', 0 );      **EDIT 2** For further clarity, here's the code I'm using to rewrite %issue%:               function fb_issue_permalink($permalink, $post_id, $leavename) {//   Fix dynamic 'issue'/'fb_entry' slug in 'fb_entry' permalink         if (strpos($permalink, '%issue%') === FALSE) return $permalink;                  // Get post             $post = get_post( $post_id );             if( ! $post ) return $permalink;                  // Get taxonomy terms             $terms = wp_get_object_terms( $post->ID, 'issue' );             if( ! is_wp_error( $terms ) && ! empty( $terms ) && is_object( $terms[0] ) ) $taxonomy_slug = $terms[0]->slug;                  else $taxonomy_slug = 'unpublished'; // Substitute 'journal issue' in slug if 'journal entry' is not categorized                  return str_replace('%issue%', $taxonomy_slug, $permalink);     }     add_filter('post_link', 'fb_issue_permalink', 10, 3);     add_filter('post_type_link','fb_issue_permalink', 10, 3);


How to debug a unit test for a WordPress plugin, which uses wordpress-test?

I'm attempting to debug a unit test for a WordPress plugin. The unit test uses wordpress-test (and PHPUnit). However, **wordpress-test**:   1. calls `system(php ...)`   2. the new external PHP process attempts to connect to the _same debugger_ ,    3. but the debugger is already busy    4. so both PHP processes hang.  — How can I prevent this? ## Details / clarifications: Initially, when I debug my unit test (like so:`$ phpunit --verbose --debug`), then phpunit connects to Netbeans on port 9000 and everything works fine. After a while, however, _wordpress-test_ runs a certain `bin/install.php` in order to setup a fresh WordPress database for the "unit" tests to use. But _wordpress-test_ runs `bin/install.php` via a `system("php ...")` call. And then the external php process attempts to connect to the Netbeans debugger again! This blocks, because the debugger is already busy — the first PHP process is open in the debugger, running the `system(...)` call. ## Issue 1 Why does the second PHP process attempt to connect to the debugger, although I've specified no debug flags? The process is created via this PHP call and there are no debug flags, here is the argument to the `system` call:               php '/var/www/wordpress/wp-content/plugins/my-plugin/wordpress-tests/bin/install.php' '/var/www/wordpress/wp-content/plugins/my-plugin/wordpress-tests/unittests-config.php'      ## Issue 2 How can I stop the external PHP process from connecting to the debugger? (Removing the external system call completely, and including `/bin/install.php` directly instead, seems complicated — there are errors like _Cannot redeclare [some-function]_ ) (By the way, if you'd like to use wordpress-test, then see this SO answer.)


Remove the More Link

I am using the "more" quick tag to cut off articles from non-paying members - as in, they can only read the first few paragraphs or so. My setup works perfectly, and here's a snippet of the code that shows what content to show when a non-paying member views an article:                   } else { // They aren't in the paying group               global $more;             $more = 0;             the_content('Interested in reading the rest of this article? You must be a subscriber to continue reading.');      }      ?>      However, this is what the code outputs to the non-paying members. For my purposes, the link is unnecessary:
 Interested in reading the rest of this article? You must be a subscriber to continue reading.
      I was wondering if it is possible to remove the link so that it only outputs like this:
Interested in reading the rest of this article? You must be a subscriber to continue reading.
      Thank you!


Open Source plugin and requires licence

Hi I am thinking of releasing a plugin, it seems that WordPress pushes for all plugins to be released as GPL. I have no problem with that, but I've noticed that Gravity forms plugin is GPL + requires a licence key. Is it ok to issue a plugin under the GPL licence but then require a licence key for it to work?


Assign certain editors to certain posts

I am using the backend in wordpress and plugin ACF to make a pupil management system for a home tuition service. As you can see in the image I have turned the "posts" into "pupils": ![enter image description here](http://i.stack.imgur.com/yFBtr.png) I have teachers who are registered as "editors". When the editors login at the moment they can see all the pupils. I only want them to be able to see their pupils. My question is how do I assign editors to specific posts so they can only access and edit posts they have been assigned to? Thank you


A way to get featuread image or first image and crop on the fly before display

1. In Loop = There exist a way or hook to get the featured image, if not, the the first image from post and cropit before display it on frontend?   2. Re-asking my question: On upload. How do I set a featured crop size for a giving custom post type like: news. Thanks in advance.


How do I pass the value from a foreach loop to an add_filter function?

I'm trying to add multiple filters from inside a foreach loop. Unfortunately I can't get the code to reference the value properly. How do I pass the value from the loop to the function? The following sets all the filters to null.               foreach ( $myarray as $key => $value ) {          add_filter( "plugin_filter_$key", function( $value ) { return $value; } );     }      This is my test code and this sets the filters to 'true'.               foreach ( $myarray as $key => $value ) {          add_filter( "plugin_filter_$key", function( $value ) { return 'true'; } );     }


Trying to get property of non-object when using $post->post_parent

I have debug set to true and to display different banners I am using conditional tags such as:               <?php          if ( is_page( 'about' ) || '2' == $post->post_parent ) {             // the page is "About", or the parent of the page is "About"         $bannerimg = 'about.jpg';          } elseif ( is_page( 'learning' ) || '56' == $post->post_parent ) {           $bannerimg = 'teaching.jpg';          } elseif ( is_page( 'admissions' ) || '15' == $post->post_parent ) {          $bannerimg = 'admissions.jpg';          } else {          $bannerimg = 'home.jpg'; // just in case we are at an unclassified page, perhaps the home page     }             ?>      This results in error like:               [24-Sep-2013 00:03:32] PHP Notice:  Trying to get property of non-object in D:\Clients\project1\www.project1.dev\wp-content\themes\custom_v1\header.php on line 100      Removing $post->post_parent fixes the PHP notice. Can anyone let me know if am doing anything wrong? **Location of this code:** I am using code structure similar to above in my header.php file. This is not inside any post loop. The cost I pasted above is from http://codex.wordpress.org/Conditional_Tags **Purpose of my code:** Based on what page the user is, I need to display different banners. So every page and its sub-pages have the same banner.               if ( is_page('114') || $post->post_parent == '114' ) { }      Even above code generates the error. Not sure why $post->post_parentis not considered an object.


Custom field only on custom post type?

I have added some fields to a custom post type through               function add_electric_portfolio_box() {             add_meta_box(                     "electric_portfolio_info", __('Detalles de la web'), "electric_portfolio_fields", "electric_portfolio", "normal"             );         }      Which I then call with:               add_action('admin_init', 'add_electric_portfolio_box');      But now those custom fields appear in regular pages too. Is it posible to show those fields ONLY on that type of post? Here is a screenshot of the undesired fields in the regular pages ![Undesired fields](http://i.stack.imgur.com/pLeF4.png) as opposed to the desired fields in the custom post: ![enter image description here](http://i.stack.imgur.com/TfQWK.png)


Using preg_replace to clean widget output HTML

I am working on a wordpress site that uses a plugin / sidebar widget. The issue I am experiencing is that the widget generates HTML that is not valid, an example of this is below...

I am item 1

I am item 2

I am item 3

I am item 4

      From my understanding there is two things wrong with this code, the first being that it uses divs (block level element) inside of a Paragraph. The second being that there is an extra P tag that is not closed at the end. I have spoken to the widget developers and, even though it is an expensive and paid plugin, are not in any rush to fix the issue. I am going to attempt to use preg_replace to clean up the code, I was wondering if anyone had any examples or tutorials to doing this and targetting just the code within the widget container? I realise this might be a question better placed on stackoverflow but though I would try my luck here first :)


Check for valid email after user inactivity?

I'm looking for a plugin that sends out a confirmation / verification email to confirm that the user still have the same email address as when they registered. If a response is not given within 2 days, the account is deleted. Is this possible? Anyone know of a plugin? I'll ask now and revise later (if I need to build my own). **EDIT** Or, it can be something where the account is inactive until the email is confirmed.


Post title not saving

I have some custom JavaScript on the admin side, on for counting the posts, the other for checking if a checkbox have been ticked.               $('.inside input').on('click', function() {              if ($(this).is(':checked')) {             console.log('checked');                 $('#title').val('overview');             } else {                 $('#title').val(title);             }         });      the other one               $('#postexcerpt').find('textarea').on('keyup', function(e) {                  max_chars = 240 - $(this).val().length;             if (max_chars < 1) {                      $(this).val($(this).val().substr(0,238));             }             $('#counterbox').html(max_chars);              });      The codes above are working. My problem is when I save the post, CPT or any other post type the Title field does not get saved? Any ideas on this? Update - Saving CPT               add_action('save_post','save_press_meta');      function save_press_meta() { global $post; $post_id = $post->ID;               if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              if( isset( $_POST['paper'] ) )           update_post_meta( $post_id, 'paper',$_POST['paper']);              if( isset( $_POST['press_article_thumbnail'] ) )           update_post_meta( $post_id, 'articlethumbnail',$_POST['press_article_thumbnail']);              if( isset( $_POST['press_article_content'] ) )           update_post_meta( $post_id, 'articlecontent',$_POST['press_article_content']);                    if( isset( $_POST['press_article_pubtime'] ) )           update_post_meta( $post_id, 'articlepubtime',$_POST['press_article_pubtime']);            }


How to redirect RSS feeds to Feedburner and keep pretty permalinks?

There are many tutorials out there, but all of them give you the same code snippet. I put it into my htaccess file, but the feeds are not being redirected. I don't want to use a plugin. I'm sure the code works. I need to figure out why it doesn't work for me. Here's part of my code:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]               # temp redirect wordpress content feeds to feedburner      RewriteEngine on      RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]      RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]      RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/ZoomingJapan [R=302,NC,L]     </IfModule>          #Prevent directory indexing     Options -Indexes          # END WordPress


post specific tag cloud, how to display in descending order from popular to less?

So I had to fiddle allot with tag cloud to display it correctly. My script limits display to 5, and since I don't display all tags, I'd like wp to output list in descending order based on popularity. So if tag has most posts it will be displayed first, and so on... Is this possible? I have a hunch I've to modify get_the_tags(), but not sure how as of now... any help appreciated! :)                                       <?php                              rewind_posts();                         while (have_posts()) : the_post();                              $posttags = get_the_tags();                         $counttag=0;                         if ($posttags) {                             foreach($posttags as $tag) {                                 $counttag++;                                 echo '
term_id).'">'.$tag->name.'
 ';                                 if( $counttag >5 ) break;                             }                         }                              endwhile;                              ?>


Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields

My problem is simple. I need to make a lot of posts containing image url's for a "photo gallery" page. I've read up a lot on creating posts from RSS feeds and imports. I've been successful at creating posts but can not somehow pass a value into a custom type. The gallery needs two url's, one for the image thumbnail and one for the full size. The code I'm using looks like this;               <?xml version="1.0" encoding="UTF-8" ?>     <!-- generator="WordPress/3.2.1" created="2011-11-14 01:56" -->     <rss version="2.0"     xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"     xmlns:content="http://purl.org/rss/1.0/modules/content/"     xmlns:wfw="http://wellformedweb.org/CommentAPI/"     xmlns:dc="http://purl.org/dc/elements/1.1/"     xmlns:wp="http://wordpress.org/export/1.1/">     <item>         <title>Pavers 1</title>         <description></description>         <Category>Flooring</Category>         <Category>Pavers</Category>     <wp:postmeta>         <wp:meta_key>port_large_image_url</wp:meta_key>         <wp:meta_value>images/portfolio/architectural.elements/Pavers.1.jpg</wp:meta_value>     </wp:postmeta>     </item>     <item>         <title>Swimming Pools 1</title>         <description></description>         <Category>Flooring</Category>         <Category>Swimming Pools</Category>     <wp:postmeta>         <wp:meta_key>port_large_image_url</wp:meta_key>         <wp:meta_value>images/portfolio/architectural.elements/Swimming.Pool.Decks.1.jpg</wp:meta_value>     </wp:postmeta>     </item>     </channel>     </rss>      I confirmed the meta_key's when I exported posts and reviewed the xml file generated. So I know I've got to be close! Evidently I'm missing something. One question to go along with this; if I understand this correctly a Custom Field are the individual "meta-key's"? Is this right? I have almost 1000 images I need to create individual posts for, complete with descriptions and categories. If I were able to "batch" them then I'd save myself a lot of time and remove the high probability of human error. I'd really be grateful to any help or a steer in the right direction.


how to modify request to get_template_part()?

i am modifying a P2 theme for a specific purpose, and it uses the `get_template_part( 'entry' )` function to get the the whole entry html. What i then get is the who `<li>` element, but i want to be able to move things around [putting meta at the end of the post, for example]. but codex has no documentation for it [that i could find]. does this mean i have to use my own entry-getting method, or making a new loop? i hope not because P2 is so well sorted. thanks a bunch for any tip! adir


Need help with major category and permalink re-organization

I would like to re-organize my categories and the permalink structure. I want to rename and merge categories, make previous categories sub-categories and change the permalink structure from `/%postname%/` to `/%category%/%postname%/` The renaming and merging is not the problem, **I am rather concerned about the resulting 404 errors**. How would you approach such a project? Thanks, Eddie


Complicated WP_Query

I'd like to query wp posts in custom way, I'm not sure whether or not WP_Query class can do this, but I'd like order the posts by posts that has a specific custom taxonomy and then continue with the rest of the posts. I've tried multiple things and tried SQL custom query but I'm not SQL expert so my SQL has an error.               SELECT *     FROM wp_posts AS wpost     INNER JOIN wp_term_relationships ON ( wpost.ID = wp_term_relationships.object_id )     INNER JOIN wp_term_taxonomy ON ( wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id )     AND wp_term_taxonomy.taxonomy = 'location'     AND wp_term_taxonomy.term_id     IN ( 1191 )     INNER JOIN (SELECT *     FROM wp_posts AS w2post     INNER JOIN wp_term_relationships as wp2rel ON ( w2post.ID = wp2rel.object_id )     INNER JOIN wp_term_taxonomy as wp2tax ON ( wp2rel.term_taxonomy_id = wp2tax.term_taxonomy_id )     AND wp2tax.taxonomy = 'location'     AND wp2tax.term_id     NOT IN ( 1191 )) inn2     ORDER BY wpost.post_date DESC      Could someone help me please? Is there a better solution than this? Can WP_Query do such an order?


common user login for multisite

I have this situation . i have multisite enabled on my blog . now i have blog A and blog B running .I did install vanilla forums on blog A . All these were on one domain with subdirectories .www.example.com/blogA, /blogB , /forum .now i want users to sign in one time to access all of them . i dont know how to do this ? and also i am using this theme in blog B http://demo.enginethemes.com/qaengine/questions/   the problem now i am facing is badge and point system .the above theme has badge&point system so does vanilla forums .if users were able to sign in one time how their profiles look like ?does the badge & point system integrate in one or not..This is a big problem i am facing .. i dont have any idea on this .any help is awesome thankyou


Lock post editing to one user at a time - wp_check_post_lock

I am creating a website where user have to be logged in to give a price bid on a product. Only one bid can be given on the product. Therefore, I only want one user at a time to be able to give a bid. Is it possible to lock post editing to one user from the frontend? So if 2 or more user enters a post simultaneously, could a message tell the other user that someone else is giving a bid? I had a quick look at this function from post.php wp_check_post_lock, but if I call it from my theme, it is unrecognized.


add_action to wp cron?

I'd like to execute some code everytime my wordpress cron runs, regardless of the timeframe. Is it possible to create an add_action for this? I looked in the filter list but I couldn't find anything relevant. Thanks!


Is there any way to run javascript on wordpress.com?

I know this might seem obvious given the security restrictions wordpress.com impose for hosted sites, however there seems to be lots of information/mis- information around, and I thought I would post here to ask wordpress specific developers. So a typical scenario: I have a widget that is generated consisting of some HTML and of course a script link to some javascript in order to do the necessary things for that widget. Wordpress.org sites are fine of course, as a user can simply add the widget code to HTML widget and so on. Wordpress.com of course strips out the script which I can understand. So is this definitely the case? is there anyway to register or deploy some sort of widget to Wordpress.com ?? (guessing here it would have to be approved/checked and so on) ?? Just trying to get some starting points. Cheers,


WP_Query Meta_key is text value and need to sort as numeric not working

I have the following code below in my ~WP_Query`.               $args[ 'meta_key'] = 'price';     $args['orderby'] = 'meta_value meta_value_num';     $args['order'] = 'ASC';      The custom field in question has historic data that was created in a custom field and set as text. When I run my query I get the following results: > 1,199.00, 1,299.99 169.99, 379.95. which looks like a correct alpha sort. However, the higher numbers should appear last and the lower values first. I have tried to adjust the custom field to numeric, however I lose the custom field data. Does anyone have a suggestion on how I should either rewrite my query or transfer my text custom field data to numeric data?


Use custom field "date" compared to today's date to display & order post list

I am at a loss here. I have a custom meta field `blser_date` where the client can use the date picker. The meta field is setup in a meta box array (this may be an issue b/c of the key?) Here is the full code for this meta box & its fields:               function add_blser_meta_box() {     add_meta_box(         'blser_meta_box',         'Service Information',         'show_blser_meta_box',         'obituaries',         'normal',         'default');     }     add_action('add_meta_boxes', 'add_blser_meta_box');          $prefix = 'blser_';     $blser_meta_fields = array(     array(         'label' => 'Date',         'desc'  => '',         'id'    => $prefix.'date',         'type'  => 'date'     ),          array(         'label'=> 'Time',         'desc'  => '',         'id'    => $prefix.'time',         'type'  => 'text'     ),          array(         'label'=> 'Location Name',         'desc'  => '',         'id'    => $prefix.'text',         'type'  => 'text'     ),          array(         'label'=> 'Location Address',         'desc'  => '',         'id'    => $prefix.'address',         'type'  => 'textarea'     ),          array(         'label'=> 'Details',         'desc'  => '',         'id'    => $prefix.'textarea',         'type'  => 'textarea'         )     );          function show_blser_meta_box() {     global $blser_meta_fields, $post;          echo '<input type="hidden" name="blser_meta_box_nonce"           value="'.wp_create_nonce(basename(__FILE__)).'" />';               echo '
';     foreach ($blser_meta_fields as $field) {         // get value of this field if it exists for this post         $meta = get_post_meta($post->ID, $field['id'], true);              echo '
                 '.$field['label'].'	                 ';                 switch($field['type']) {                               // Date                     case 'date':                         echo '<input type="text" class="datepicker" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                     break;                               // Time                     case "time":                         echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                     break;                          // location name                     case 'text':                         echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                     break;                          // address                     case 'address':                         echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                     break;                          // details                     case 'textarea':                         echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                     break;                      } //end switch         echo '
';     } // end foreach     echo '
'; // end table     }          // Save the Data     function save_blser_meta($post_id) {     global $blser_meta_fields;          // verify nonce     if (!wp_verify_nonce($_POST['blser_meta_box_nonce'], basename(__FILE__)))          return $post_id;     // check autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)         return $post_id;     // check permissions     if ('page' == $_POST['post_type']) {         if (!current_user_can('edit_page', $post_id))             return $post_id;         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;     }          // loop through fields and save the data     foreach ($blser_meta_fields as $field) {         $old = get_post_meta($post_id, $field['id'], true);         $new = $_POST[$field['id']];         if ($new && $new != $old) {             update_post_meta($post_id, $field['id'], $new);         } elseif ('' == $new && $old) {             delete_post_meta($post_id, $field['id'], $old);         }     } // end foreach     }     add_action('save_post', 'save_blser_meta');     ?>      If the issue that `blser_date` needs its own key, how and where do I create this? I am trying to list post within different tabs on the site. One tab will be for Current Services (dates that are today and/or upcoming). The second tab will be for Recent Services (dates that have passed todays date - In descending order with in the last 30 days of todays date). Here is the code for the tabs as of right now (I am sure it is trashed up by this time):

Current Services

Recent Services

              <?php         $today = date('Y-m-d', strtotime('+30 days'));         $args = array( 'post_type' => 'obituaries', 'meta_key' => 'blser_date' , 'posts_per_page' => '10',  'orderby' => 'meta_value_num', 'order' => 'ASC', 'meta_compare' => '>=');          $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?        php the_title_attribute(); ?>"><?php the_post_thumbnail( ); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php     the_title_attribute(); ?>"><?php the_title(); ?>

<?php echo get_post_meta( get_the_ID(), 'bldob_bdate', true ); ?> ~ <?php echo     get_post_meta( get_the_ID(), 'bldob_ddate', true ); ?>

Service: <?php echo get_post_meta( get_the_ID(), 'blser_date', true ); ?>

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

         <?php         $today = date('Y-m-d', strtotime('-30 days'));             $the_query = new WP_Query( array(           'post_type' => 'obituaries',           'posts_per_page' => 10,           'meta_key' => 'blser_date',           'orderby' => 'meta_value',           'order' => 'DESC',           'meta_query' => array(           array(             'key' => 'blser_date',             'value' => $today,             'compare' => '<',             'type' => 'DATE'           ))         ));          while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?    php the_title_attribute(); ?>"><?php the_post_thumbnail( ); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php     the_title_attribute(); ?>"><?php the_title(); ?>

<?php echo get_post_meta( get_the_ID(), 'bldob_bdate', true ); ?> ~ <?php echo     get_post_meta( get_the_ID(), 'bldob_ddate', true ); ?>

Service: <?php echo get_post_meta( get_the_ID(), 'blser_date', true ); ?>

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

      Here is a link to view the actual page if it will help at all: page


Subsite migration across servers including all media and links

Our development stack includes creating sub sites on a dev server and push to the production server when the sub site is complete. However, migrating these sites has been tricky and time consuming. I've tried to use the basic WP export/import but all the images added via the 'add media' function in the rich text editor are links with absolute URLs and thus, the image links are all broken during the migration. I've tried to relocate the media into the same directory structure on the production server to no avail. These images never go through the WP import so they don't appear in the media area. I'm basically having to import the new site, import all media again, and relink every single image. Does anyone know of a method that will expedite this process? Your time is much appreciated.


wp.getPosts with status = 'trash' using node.js

I was wondering how to set the filter option for wp.getPosts. I want to get posts with a status of 'trash'. filter is currently blank, and returns all posts other than trash. I am using the xmlrpc wordpress api and the node-wordpress plugin. https://github.com/scottgonzalez/node-wordpress Here is my current code:               wp.getPosts('<filter>', ['title','status'], function(err, data){          });      I am not sure what to put in the filter section, all the examples I could find are PHP examples and do not work in this context where I am using Javascript. Is it even possible to get the posts with a status of 'trash'?


Set Value To Custom Field While Submit

Is it possible to set an automatic value to a custom field while submitting the post in wordpress? When I post I need that this custom field take automatically the first letter of the post title. Example: If my title is "Example" The custom field value is "E".


Custom Status not displayed in Quick Edit

Using Piklist, I have created CPT booking with custom status (`draft`=>'waiting confirmation' and `confirmed`). This custom status is displayed well in Create/Edit page. ![enter image description here](http://i.stack.imgur.com/xCbI9.png) But, it won't show up in quick edit ![enter image description here](http://i.stack.imgur.com/deWsQ.png) Here is my syntax:               <?php     /**      * Register CPT booking      */     add_filter('piklist_post_types', 'morpha_event_booking_post_type');      function morpha_event_booking_post_type($post_types)      {       $post_types['booking'] = array(         'labels' => piklist('post_type_labels', 'Bookings')         ,'title' => __('Enter a new Booking')         ,'show_in_menu'  => 'edit.php?post_type=morpha_event'         ,'public' => true         ,'rewrite' => array(           'slug' => 'event'         )         ,'supports' => array(         )         ,'hide_meta_box' => array(           'slug'           ,'author'           ,'revisions'           ,'comments'           ,'commentstatus'           ,'pyre_post_options' // avada metabox           ,'sbg_box'         )         ,'status' => array(           'draft' => array(             'label' => 'Waiting Confirmation'           ),           'confirmed' => array(             'label' => 'Confirmed'           ),         )       );     return $post_types;     }


How to change the Author Slug from Username to Nickname and deal with Special Characters

I need to change the author slug from username to nickname: This is what is set by default: http://domain.tld/author/(username) This is what I need: http://domain.tld/author/(nickname)-(author-ID) As I am running a multi-author-blog, I do need a functional fix instead of manually changing the author slug in the database. I tried the following workaround, but some authors are using special characters (e.g. "&", accent marks or umlauts) in their nickname, which is failing the solution. Additionally, I need to get a solution for duplicate author nicenames. Maybe its possible to add the author ID to the end of the author slug?


Assign Taxonomy Term from Post on media upload?

First off let's begin at the code:               add_filter('upload_dir', 'set_destination_folder', 999);          function set_destination_folder ( $upload_data ) {       if ( ! isset( $_REQUEST['post_id']) )         return $upload_data;     $destination = get_post( $_REQUEST['post_id'] );     $destinationtype = get_post_type( $_REQUEST['post_id'] );     $states = get_the_terms($_REQUEST['post_id'], 'games_titles');          if ( empty($states) || ! is_array($states) ) {         $subdir = '/' . $destinationtype . '/' . $destination->post_name;     } else {         $subdir = '/games_titles/' . array_shift($states)->slug;     }        $dir = $upload_data['basedir'] . $subdir;     $url = $upload_data['baseurl'] . $subdir;            return wp_parse_args(array('path'=>$dir, 'url'=>$url, 'subdir'=>$subdir), $upload_data);     }      Above is some code I worked on so that my uploads get intelligently grouped based of the games_titles taxonomy terms. So Example: Sonic Lost World = `\wp- content\uploads\games_titles\sonic-lost-world` Now in file management this works great apart from I am unable to share the uploaded files over multiple post types without display all uploaded files. A solution to this would be the ability to also assign the games_titles term on upload to the file itself, to then be further used as a query to get all matching attachments with the same term to be used over multiple post types from within the Media Library tab inside the posts creation. *** Addition *** Registered the same Taxonomy to the 'attachment' object.               function wptp_register_attachments_tax() {         register_taxonomy( 'games_titles', 'attachment');     }     add_action( 'init', 'wptp_register_attachments_tax', 0 );      Simple and works. Now just at final stages to get this taxonomy term to be applied automatically on upload. Then additionally show the files with the same taxonomy term in the posts Media Library on creation, rather than 'images'or 'Uploaded to this page'. The possibility or a extra drop down option that acts as 'Game Title Related' would be brilliant. **Been few weeks** and been trying for hours again today. I can manually assign the taxonomy by going to the media library which is okey but not what I am trying to achieve. The post itself will already have the taxonomy term so I just need a way to auto assign this on upload. Then I have found no information on how I would use this as a drop down option for getting the attachments with the same term from the media menu from within posts. Any advice would be great as been using `media_upload_tabs` but this does not show from within a post media selection window. **Example of what I am after:** Article > game_title(sonic_lost_world) > Set Featured Image > uploaded media (+ add game_title(sonic_lost_world) taxonomy term to file automatically) > Update post. Now For example I got to review > game_title(sonic_lost_world) > Set Featured Image > Media Library > Show all with game_title(sonic_lost_world) (Rather than just 'uploaded to this page' and 'images') I will keep trying but after several full days on this over a few weeks it is obvious I am missing a key part. ![Breakdown of Problem](http://i.stack.imgur.com/s9irO.jpg) **Found Answer Here -https://github.com/Horttcore/Media-Taxonomies**


WP_Query fails despite having 1 post

I'm doing a typical custom post type query with args like this:               array (size=4)       'post_type' => string 'custom_post_type' (length=15)       'post_status' => string 'publish' (length=7)       'posts_per_page' => int 5       'p' => string '2943' (length=4)      Yet amazingly, despite the fact that there IS one post being queried (and it _does_ exist) I get a `false` in the loop for have_posts What strange phenomenon is responsible for this? There IS 1 post!                   $wp_query = new WP_Query( $args );         if ( have_posts() ) :             //...             while ( have_posts() ) : the_post();             //more dots ... dot dot dot ...             endwhile;             //...         else:             echo 'No stuff found ... dot dot dot';         endif;


Creating Multiple Admin Widget Page with Calling One Sidebar

Does anyone know how to create multiple admin widget pages with calling specific sidebars? In Detail, I have a custom post type called Groups and I am creating new admin pages in the back end. I added a submenu to Groups called Widgets. I created a sidebar for Groups and I want to add this sidebar to the Groups widget page. So, it is just like usual admin widget page but with only one sidebar. So far,               $post_type = $_REQUEST['post_type'];     $retrieved_widgets = retrieve_widgets();     foreach ($retrieved_widgets as $key => $value) {        if ( $key !== "groups-sidebar" ) {         unset($retrieved_widgets[$key]);         }     }          $wp_registered_sidebars = $retrieved_widgets;     //print_r($wp_registered_sidebars);     require_once(ABSPATH . 'wp-admin/widgets.php');      This code adds only the groups sidebar to the Groups Widget page. But I have some errors such as               Notice: Undefined index: class in D:\wp-admin\widgets.php on line 369       So I am guessing something is missing or not configured properly.


Showing code only on Front Page "Posts Page"

I have some code that I would only like to be displayed on the sidebar when on the blog (the page that displays the posts). Now I am using this code...               <?php if(is_page('37')) { ?>      ...Show code...     <?php } ?>      The strange thing is if I enter any other page ID, it works as expected and shows the code, however, when I enter ID 37 (blog page), the code does not show on the blog page. Do I need to do something differently as it is my main post page and not a regular page? _P.S By Post page, I mean the page I have set in the wordpress admin where posts should be displayed._ ![wp-admin reading settings](http://i.stack.imgur.com/gurUA.png)


plugin will not offer update even though a new version is available

I made a plugin, made revisions to it, and commited it again, yet in the admin area under plugins, I do not see under my plugin that an update is available. So I had, say, version 1.2.0 , and now I made a new version 1.9.0 and I commited it, and on the wordpress site if you click the download button you WILL get the 1.9.0 version, but people that already have version 1.2.0 installed won't see an update option. Also, on the wordpress site, it always says "Download version 1.0", even though the current version is 1.9.5 (that's what it says in the readme.txt under the stable tag) How to fix this?


Wordpress post feature image not uploading

Wordpress admin side post page feature image not uploading. Getting error like below **An error occurred in the upload. Please try again later.** Please give me answer.


I want to use WP UI tab in my header.php

I want to use WP UI tab in `header.php` instead of any pages or post. In pages I can add like this:               [wptabs mode="horizontal"] [wptabtitle] Map[/wptabtitle] [wptabcontent]map detail[/contentment][wptabtitle] Get Bids[/wptabtitle] [wptabcontent]bid detail[/wptabcontent] [/wptabs]