Many to Many select metabox

How can i create a metabox on a custom post type similar to how you input tags where it's free text - auto suggest drop down selection while adding multiple values to the category? For instance if I have a restaurant custom post type then want to select the cities that it applies to ( I don't want to use check boxes because I might have thousands of cities). I want to do free text entry with drop down suggestions and then you select from the list of suggestions while allowed to do multiple entries just like adding tags to a Post. Ideally, I'd like to lock it to where it only let you select one from the drop down (pulled from DB) and not freely type in your own value. I've spent a few hours scouring looking for some information on how to do this, but can't find anything. Maybe I'm using wrong terminology to search for it? Any help would be great. thanks.


Scanning Database for malicious Data

After a site of a friend has been hacked I told him he should just clean up the mess and restart from scratch so he know that no file has been altered. I could scan the site for him with tools like grep an so on (For a start: Grep and Friends) but what I wondered about is, how to scan the database? What if some hacker has placed payload inside the database. Can be something simple like XSS or even PHP code in case there is some eval'ing still going on in core (or was at the time of the hack). Any suggestions? I thought about using SQL-Queries with the LIKE comparison function or there is even some REGEX possible. But maybe someone has already done this or wants to do this an has some ideas to share.


Hooking "delete_option_rewrite_rules" for rewrite rule addition

I'm trying to find the most efficient way to ensure my word press "rewrite rules" are set correctly in the event that another plugin calls the `flush_rules()` function. Traditionally I've seen instructions on adding the rules on every page load of your plugin (eg here)               add_action('wp_loaded','define_rules_here');     function define_rules_here()     {       add_rewrite_rule($foo,$bar,$yams);     }      My concern is the way I've written my plugin is the rewrite rules are configurable by the user, and that having to load the options from the database for every page load seems inefficient. I've found little information on the following, but it seems just as valid...               add_action('delete_option_rewrite_rules','define_rules_here');     function define_rules_here()     {       add_rewrite_rule($foo,$bar,$yams);     }      What I've found is that the first thing `flush_rules()` calls is `delete_option('rewrite_rules');` which seems to trigger my hook quite nicely as the `delete_option` function ends with a `do_action( "delete_option_$option", $option );` call. My question is: Is there anything fundamentally wrong with this approach of hooking into the "delete_option_rewrite_rules" action?


How to remove commenters ability to add hyperlinks to comments?

I'd like to be able to filter out a commenters ability to add hyperlinks in their comment text. I removed the "websites" field from the mix to reduce the amount of spammage already (see: Removing the "Website" Field from Comments and Replies?") which has helped a lot. By default, they can use the '< a '> tag to do so in the comment box text, which allows spammers to embed hyperlinks to their sites. Is there a way to filter out that capability in the wysiwyg editor for comment fields?


How to retrieve hashtaged tweets from a list of users and post to Wordpress

Is there any way retrieving all the tweets from a list of profiles which are tagged with certain #hashtag using Twitter API 1.1 and applying it as a feed to Wordpress? I have found this but I'm not able to get this to work with Wordpress. Thanks


Show Future and Published posts in category archive

I want to make a list of events using a blog category. Category page shows Published and Future posts. Tricky thing is that I want to show Future posts on top with posts sorted by:               'order' => 'ASC'      ... and published posts sorted by default:               'order' => 'DESC'       so far, I've got the publish and future posts on the same cat template working with this placed on functions.php:               function special_cat_template($query) {         if ( !is_admin() && $query->is_main_query() ) {                  $conf_cat = get_category_by_slug( 'slug' );             $conf_cat_id = $conf_cat->term_id;             $cat = get_queried_object();             $cat_id = $cat->term_id;                  if ( $query->is_category( $conf_cat_id ) || cat_is_ancestor_of( $conf_cat_id, $cat_id ) ) {                      $query->set( 'post_status', array( 'publish', 'future' ) );          }   }   }     add_action('pre_get_posts','special_cat_template');      You guys think that this is doable? or should I use more than one loop?


Is there an error in get_the_tag_list()?

I'm using the theme TwentyThriteen1.0 for my WordPress blog. I recognized that the tags in the meta-part of an article are not separated by a comma. I had a look at the function `twentythirteen_entry_meta()` in the file `functions.php` of my theme, which contains:               $tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );      According to the documentation for `get_the_tag_list()` (http://codex.wordpress.org/Function_Reference/get_the_tag_list), the tags should be separated by a space after the comma. Looking at the HTML source reveals `</a>,<a href=`, instead of `</a>, <a href=`. When I now add a space in the `functions.php` in front of the comma:               $tag_list = get_the_tag_list( '', __( ' , ', 'twentythirteen' ) );      the HTML source has both spaces: `</a> , <a href=`. This is really strange to me,... Is this a error or deliberate? Or is this an error of the function `translate()` (alias `__()`) that removes trailing spaces if there are no leading spaces? I'm using the german version of Wordpress.


How do you load js and style resources from CDN with local fallback using wp_enqueue_scripts?

I had a hard time finding the correct way to do this. I want to load the CDN resources here: http://www.bootstrapcdn.com/ but use `wp_enqueue_scripts` and have local fallback. This is the method I am using for local fall back now directly in header.php:               <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>     <script>window.jQuery || document.write('<script src="js/jquery.js">\x3C/script>')</script>      I want something like this for all resources but also using wp_enqueue_scripts. I successful switched the enqueue Jquery using this method but this does not provide a fallback:               /** Jquery **/     wp_deregister_script( 'jquery' );     wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.5./jquery.min.js','', 'latest', true );     wp_enqueue_script('jquery','','',true);      Any help is greatly appreciated!


Sends out email to admin with post author

Hello i'm using this :               add_action('publish_post', 'send_admin_email'); function send_admin_email($post_id){         $to = 'admin@email.here';         $subject = 'subject';         $message = "Here is :".get_permalink($post_id);         wp_mail($to, $subject, $message );      to send out a mail to wordpress admin when a post is publish by author. And I would like to add the post author in $message. I try `get_the_author();` and `the_author();` but nothing happens. Any ideas guys ? Thank u ! (Sorry i'm french)


How can I add a 'Click to Enlarge Image' feature, with the enlarged image opening in a popup?

I have several images of UI forms and tasks, that are quite large. I would like to display a smaller, 'thumbnail' image snf give the user an option to 'Click to Enlarge', and then display the fill size image in either a pop-up or separate window or tab. I pop-ups are frowned upon, but this is a decision I must still make. How would I go about this? Where would I place the JavaScript that loads the full size image and opens a new window?


Sortable columns by meta value holding a date - can't get it to work

I'm trying to sort the posts (in the edit screen (wp-admin/edit.php)) by meta value corresponding to an event date but I can't get it to work properly... For example, `ASC` returns: 2012/10/12   2012/12/11   2012/09/7   and `DESC` returns: 2012/09/7   2012/12/11   2012/10/12   I'm using the following functions to create the sortable custom columns:               function event_date_column_display( $name ) {         global $post;         switch ($name) {             case 'event-date':                 $pid = $post->ID;                 $event_date = get_post_meta($pid, '_event_date', TRUE);                      if ($event_date) {                     echo $event_date;                 }         }     }          function event_date_column_register_sortable( $columns ) {         $columns['event-date'] = 'event-date';           return $columns;     }      Any hint on how to fix this?


Single page theme that uses pages for the content

I'm making a one page site. On the page I want to run WP_Query three or four times to pull in those 3-4 pages. The page looks a bit like this:
      <?php              $args = array( 'pagename' => 'page-1');               $the_query = new WP_Query( $args );              // The Loop         if ( $the_query->have_posts() ) :         while ( $the_query->have_posts() ) : $the_query->the_post();           get_template_part('content');         endwhile;         endif;              // Reset Post Data         wp_reset_postdata();     ?>

      <?php              $args = array( 'pagename' => 'page-2');               $the_query = new WP_Query( $args );              // The Loop         if ( $the_query->have_posts() ) :         while ( $the_query->have_posts() ) : $the_query->the_post();           get_template_part('content');         endwhile;         endif;              // Reset Post Data         wp_reset_postdata();     ?>

      <?php              $args = array( 'pagename' => 'page-3');               $the_query = new WP_Query( $args );              // The Loop         if ( $the_query->have_posts() ) :         while ( $the_query->have_posts() ) : $the_query->the_post();           get_template_part('content');         endwhile;         endif;              // Reset Post Data         wp_reset_postdata();     ?>
      Of course I'm repeating myself here, and that's a bit of a waste. What I want to do is function-ize this instance of WP_Query. Here's what I've done, but it doesn't seem to return anything at all. It has to be something stupid, but I can't see what it could be (in functions.php):               /**      * Functionize wp_query      *      * @since 0.1      */     function waterstreet_fetch_page( $pagename ){         $args = array( 'pagename' => $pagename );               $the_query = new WP_Query( $args );              // The Loop         if ( $the_query->have_posts() ) :         while ( $the_query->have_posts() ) : $the_query->the_post();           get_template_part('content');         endwhile;         endif;              // Reset Post Data         wp_reset_postdata();     }      Then of course, in my template files, I want to be able to just run:
         <?php waterstreet_fetch_page('page-1'); ?>

         <?php waterstreet_fetch_page('page-2'); ?>

         <?php waterstreet_fetch_page('page-3'); ?>
      Advice welcome! Thanks.


Deregister a CSS file that comes with a plugin

WPML plugin comes with its own CSS file. I want to get rid of all the CSS it contains, so I put everything between `/* */`. However I'll have to do that again when I'll update the plugin. Is there a way to "unload" a CSS file ?


Change default from "Attachment post URL" to "File URL" in Add Media

When a user upload images, by default, the Attachment Post URL option is selected. How can I change the default to be "File URL"? If that is not possible, how can I remove the attachment post url completely? I made a Google search that brought more questionmarks than answers. EDIT: I found a way to disable the attachment post URL, this code works:               add_filter('attachment_fields_to_edit', 'my_attachment_fields_edit', 10, 2);      function my_attachment_fields_edit($form_fields,$post){          //Set attachment link to none and hide it.         $html = "<input type='hidden' name='attachments[".$post->ID."][url]' value=''/>";              $form_fields['url']['html'] = $html; //Replace html         $form_fields['url']['label'] = ''; //Remove label         $form_fields['url']['helps'] ='';//Remove help text              return $form_fields;     }      However I am still looking for a way to change which one is set as default.


How to list the Hooks and order of execution in current loading page?

I need to know the list of hooks that are called in the current page . How to identify the priority assigned to the action and filters in the action . If i want to remove the default action on word-press . It cause any error ? May i overwrite the default action that to be execute?               add_filter( $tag, $function_to_add, $priority, $accepted_args );       in this case i change the priority as 50 . i don't get any changes compare with 10 or Default. if This Priority value is for order of execution means i need to change the values as bigger or smaller?.


[&hellip appearing instead of [...]

There is some problem with my wordpress website, instead of [...] I am getting [&hellip everywhere. I have changed the charset to UTF-8 but the problem persists. Any help would be appreciated. Here is the link to the website : http://theappjuice.com/


Wordpress subadmin can create N user

Is there a way to create a subadmin that has a capability to create a number (N) another users. So that, if the subadmin has reached N value, he can't add another user anymore.


Execute PHP code in Javascript onclick

When a user clicks on the table row, I want to:   * save a value in the user profile   * go to a page I am within this loop:               <?php $query = new WP_Query(array('post_type' => 'aanvraag', 'posts_per_page' =>'-1', 'post_status' => array('publish', 'pending', 'draft', 'private'/* , 'trash' */) ) ); ?>     <?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>     <?php endwhile; endif; ?>      This is not working:               <tr onclick="window.location.href='http://www.areal-agro.nl/<?php          $user = get_the_title();         update_usermeta( $current_user->id, 'current_user', $user );             ?>'">      If I `echo` the `$user` value, it outputs the right (current) value.   If I use the `update_usermeta` as written, it uses the last value.   If I use `update_usermeta( $current_user->id, 'current_user', 'test');` it works. How can I export the **current** value? Why is `onclick` not behaving like it's in the loop, and how can I improve this?


Which files get updated in a plugin update?

When a user updates a plugin from the WordPress admin panel, does every plugin file get overwritten, or just the ones that have changed from the previous version? For example, let's say that a plugin has 3 files: a.php, b.php, and c.php Version 2.0 has changes to a.php and b.php; c.php was unchanged. However, the user made a change to c.php before updating to 2.0. Does the user lose his changes?


Where do URI files come from?

Installed locally or in a web server, how is a file (for example, style.css using `wp_enqueue_style`) created? More specifically, when I tried this using the default twentythirteen theme:                echo get_stylesheet_uri();      I get this: `http://yourwebsite.com/wp- content/themes/twentythirteen/style.css`. So I thought of trying to go to `http://yourwebsite.com/wp-content` but was surprised that nothing comes out. However going to the stylesheet URI will bring out the stylesheet. Where's the server keeping this file? Another related question would be:                echo get_theme_root().'twentythirteen/style.css';      VS                echo get_stylesheet_uri();      I know the above is a directory while the one below is the URI example I've given above, but how are they different in terms of linking content of the file itself?


Creating an online questionnaire form - by Importing the questions from a spreadsheet?

I've got a spreadsheet where each row of the first column is a question, and the next 4 columns are the optional 4 answers to that question. I want to turn these questions into an online form (like as the one offered by google docs) Is there a form plugin (or another solution) that can offer something like this?


Categories Listing with "selected" category highlighted

Is there a way to draw the categories listing and highlight the current category being viewed? In addition, it would be great to highlight the current category if a post or page that's assigned to it is being viewed. Any help much appreciated... Here's my current code (I'm excluding the default "uncategorized" category)...                 echo "

";         $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);         $cat_args['title_li'] = '';         $cat_args['exclude_tree'] = 1;         wp_list_categories(apply_filters('widget_categories_args', $cat_args));       echo "

";


Calling a function from functions.php in header

Been searching a lot for how to call a function in header.php where the function is in functions.php. How do I solve this? I have my function in functions.php like this:               function testFunction()     {     echo "This is a test";     }


Different widgets on different page templates?

If I have a couple of different Page templates, how would I show a different collection of sidebar widgets for each of these templates? I'm using the Starkers theme as a starting point.


Is there a way to remove categories in bulk?

I just migrated to worpress and want to remove all of the 'uncategorized' categories, since all of my posts are now all categorized. Is there a way to do this easily?


How do I add to the list table a filter?

I am trying to find the hook for adding a filter to the list under "Posts [Add New]": ![enter image description here](http://i.stack.imgur.com/2xDQ3.png)


Tracking Published Date as Custom Variable for Google Analytics

I want to track traffic with Google Analtyics based upon the post publish date. For example, what new articles are doing well or poorly compared to similarly published posts. I added this before my analytics code with no avail:                   <script type="text/javascript">_gaq.push('_setCustomVar',1,'Publish Date','<?php the_date('F j, Y', '', ''); ?>', 3);</script>


Sticky Header in Wordpress using BootstrapWP theme

So I am using Rachel Baker's open source BootstrapWP starter theme to develop a Wordpress theme. There is a repository on Github but I didn't think this question was appropriate to post there. I am trying to get the header to be static but I am unsure of how to make it work. I have found a working example that achieves this with this theme but I can only see the HTML output as an example. I am a novice Wordpress coder just trying to figure things out. I cannot see or figure out what is the best way to achieve this. So on the example site where this feature is working the HTML being output by the header.php file has different classes of the header so that depending on where the browser is the correct header will be displayed. It outputs three separate nav-menu lists in the HTML. The first nav-menu starts with `<li id="" >` and the following two don't have an id, they only have `<li class="">`. Here is a pic: ( Or just see the pastebin shared below) ![enter image description here](http://i.stack.imgur.com/qBy2J.png) Here is a pastebin of this code including the jquery script being used. I am assuming that this can be achieved with the wp_nav_menu php code in the header but I wasn't sure how to do this.                               <?php wp_nav_menu(                             array(                             'menu' => 'main-menu',                             'container_class' => 'nav-collapse collapse left-aligned nav-collapse-main',                             'menu_class' => 'nav',                             'fallback_cb' => '',                             'menu_id' => 'main-menu',                             'walker' => new Bootstrapwp_Walker_Nav_Menu()                         )                     ); ?>      Theme has a Custom Walker file which is in the includes folder, can be easy seen in the Github repo, this site wouldn't let me share more than 2 links per post, sorry. I've got lots of questions but I think my first one would be, do I need a loop of multiple wp_nav_menu calls or is there a better method? Thought this would be a nice feature for anybody using Bootstrapped Wordpress themes, hope someone can help.


Search results in custom template

I have a custom page `resources-search.php` template which handles search results for the search form. And in my `function.php` I have the following array:               $YearList = array('2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013');      Yes, You guessed it right. Its an array of year. In my `resources-search.php` I' am using this code:               <select name="year" id="opt_year">     <option value="0" selected="true" disabled="true">Year</option>     <?php     foreach($YearList as $key => $value){     echo '<option value="'.$value.'">'.$value.'</option>'; //close your tags!!     }      ?>     </select>      Its a drop-down menu from the array above. This method doesn't actually works for me. In other pages it does work but not in `resources-search.php`. Any ideas anyone?


Need equivalent of single_term_slug

I am building a taxonomy archive page and I am trying to create a linked instance of the current term outside the loop. So, let's say my taxonomy and current term are:   * Taxonomy: Animals    * Term: Elephants I want to echo the term Elephants and have the term name linked to the Elephants term archive. So, this would be the output:               Elephants      Elsewhere I use single_term_title(); and that perfectly grabs the term name for that specific archive page. In other words, I can echo the title fine. I just want it linked to the archive page for that term. In an ideal world, the code that I want would be:               <a href="http://www.mywebsite.com/tag/<?php single_term_slug(); ?>/"><?php single_term_title(); ?>      There is no single_term_slug(); and I have tried a number of things, but so far nothing has worked. Another alternative is that I am trying to echo the permalink for the current page. I have looked into ways of doing it that was as well. Something like get_canonical(); but that does not exist either. So either the answer is something that I have not found or could not come up with myself... Or it is so darn easy that it is right in front of my face (which could very well be the case). Thanks.


The Best Way to always load the newest version of 3rd party code

There is a class for plugins and themes that makes custom meta boxes easier to develop called cmb_Meta_Box from Custom-Metaboxes-and-Fields-for-WordPress at https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress and they update that class and code. I'm trying to make sure that if I use the latest version of this class/script in a plugin that if a user has an older version of it, it fails gracefully. So, for example, 1.1.0 has some new features, but if someone already has loaded 0.9.0 from another plugin that loaded before my plugin, what can I do? There is now a constant so I'm thinking I could warn the user on my admin pages, but if they're not technical they wouldn't know what to do with that warning. I hope this makes sense and some folks have ideas what I can do within WordPress to solve this possible issue. Thanks!


Automatic updates in plugin - not hosted on wordpress repository

I'm coding a plugin which probably will have updates in the future, and I want to take advantage of the automatic update mechanism in wordpress. I followed this tutorial: Everything seemed quite straightforward to me, but for some reason, nothing works. The function hooked to the `pre_set_site_transient_update_plugins` filter never gets called. I tried to go step by step and just added a "Hello" and a log line on that hook. It simply doesn't get called, even when I tried to force the update checks. Is there any catch on that? Btw, I'm trying that on a multisite installation. Any help would be greatly appreciated. Arnaldo UPDATE: I got the function hooked to the `pre_set_site_transient_update_plugins` to be called. Strangely, if I do the hooking inside the constructor of the object which has the checking function it works, otherwise, it doesn't. Example (this works):               class XYZ {         public function __construct() {             add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));         }              public function check_update($transient) {             // logic here         }     }      However, if I simply do this on my main plugin file, it doesn't work:               add_filter('pre_set_site_transient_update_plugins', array('XYZ', 'check_update'));       First of all, I'd like to understand what's the difference between the two scenarios. Besides that, I had to do               set_site_transient('update_plugins', null);      to force the hook to be called, otherwise I think I'd have to wait the normal wordpress update check cycle, right? And now, another issue has surfaced: the `$transient` variable which is passed to the `check_update()` function is always null! Is that because of the `set_site_transient()` instruction? If it is, how can I check the whole solution without suffering for several hours to be able to test my latest changes? Thanks again, Arnaldo UPDATE 2: @kaiser, the behavior is exactly as I described, even using a static method. I had tried that already.


Getting error when trying to redirect WP site to mobile site

I've tried a few different plugins to redirect a WP site to a static page for for mobile devices smaller than iPads. Of the several I've tried, I get the following error. Can someone tell me what's causing the error or direct me to a thread or article that I can follow to just create the code without a plugin? I'm trying to keep the plugin count as low as possible. Thanks! _Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration._ I'm using the latest version of WP 3.7.1. core site: http://clients.weinsteinau.cgvcreative.com/ mobile: http://clients.m.weinsteinau.cgvcreative.com/ This is the error I get when I install the Equivelant Mobile Redirect plugin. *Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/green83/public_html/clients/weinsteinau/wp-admin/includes/plugin-install.php on line 77* I don't have the exact code since I don't know where the error is coming from. This is what happens when I activate the plugin: *Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/green83/public_html/clients/weinsteinau/wp-includes/update.php on line 259*


Parse Shortcodes in Theme's Custom Field?

I have a theme which has a "PRICE" custom field that only accepts numerical values. Is there anyway to parse shortcodes in that custom field so I can dynamically display the price using another plugin? Thanks!


Object of class WP_Error could not be converted to string

After deleting some categories (shouldn't have done this), I get the following error > Catchable fatal error: Object of class WP_Error could not be converted to > string in [FILENAME] on line 45 Here's the file which caused the error. Here's an excerpt (line 45 is `$output .= '<a href="' . $link . '">' . $term->name. '</a>, ';`)                  ...       foreach($item['value'] as $value) {             $term = get_term($value, $fieldSettings['taxonomy']);             $link = get_term_link($term);                  // no option may inerrupt !             if(!$term) {               continue;             }                  if(isset($formatterSettings['link_bool']) && $formatterSettings['link_bool']) {               $output .= '' . $term->name. ', ';             } else {               $output .= $term->name . ', ';             }           }         }      ...      How can I fix this problem? I recreated all the deleted categories (I backuped their names and slugs), but the error still remains. Thank you for your help! Here's the complete file               namespace Hydra\Formatters;          use Hydra\Builder;          class TaxonomyFormatter extends BasicFormatter {            public function __construct() {         $this->name = 'taxonomy';       }            public function render(\HydraFieldViewRecord $viewView, $post) {              $items = $this->getValues($viewView);         if(!$items) {           return $items;         }              $fieldSettings = $viewView->field->attributes;         $formatterSettings = $viewView->settings;              $meta = $viewView->field->meta;         $output = '';                   foreach ($items as $item) {           if(is_string($item['value'])) {             if($item['value'] == 0) {               continue;             }             $item['value'] = array($item['value']);           }                foreach($item['value'] as $value) {             $term = get_term($value, $fieldSettings['taxonomy']);             $link = get_term_link($term);                  // no option may inerrupt !             if(!$term) {               continue;             }                  if(isset($formatterSettings['link_bool']) && $formatterSettings['link_bool']) {               $output .= '' . $term->name. ', ';             } else {               $output .= $term->name . ', ';             }           }         }              $output = trim($output, ', ');         $terms = $output;              $output = '';         $output .= '
printAttributes($viewView) . '>';              if ($meta->prefix) {           $output .= "
" . $meta->prefix . "
";         }              $output .= "
" . $terms . "
";         if ($meta->suffix) {           $output .= "
" . $meta->suffix . "
";         }         $output .= "
";              return $output;       }            public function getSettingsForm($parentElement) {         parent::getSettingsForm($parentElement);         $parentElement->addField('checkbox', array('link_bool', __('Link to taxonomy page', 'hydraforms')))           ->setDefaultValue(false);       }     }


Some blog posts containing source code fail to save draft or publish

I have a blog that contains source code on some posts. I've discovered that some posts don't accept the source code and I get variously a Server 500 error or a 403 error. I can only assume there is some protection mechanism in Wordpress that sees the source code and rejects it. However, as my hosting doesn't seem to have any logging enabled I cannot see what is wrong with it (assuming, of course, I'm looking in the right place for a log - which I may not be. I've only just migrated my blog and I'm still learning the technical detail about how WordPress works yet.) I've narrowed it down to two types of source code:   * SQL code   * Razor (the new view engine that arrived with ASP.NET MVC 3) I've found a work around for getting these posts in to WordPress (Uss the Wordpress RSS Import plugin and copy my post in to an artificial RSS feed file which I import). This is rather unwieldy and I frequently find typos so need to update posts. The importer only ever creates new posts so I can't correct any errors. Any ideas about how to get posts with source code into Wordpress? I'm using Windows Live Writer to create and publish posts, but as a work around for problematic posts I can always copy and paste the raw HTML then edit directly in the admin pages in Wordpress, but I get the same issue. Any help much appreciated.


Infinite Scroll applied to ajax loaded content

I'm doing a WP_Query on let's say page-a.php, that page has a div called target where page-b.php is being loaded into. Page-a is a custom template and page-b is an archive page. The structure on page A as example:

       while

Title

Description

       endwhile

           On page-b I only include the < post > and < pagination > divs within a regular wp loop. Now the jQuery:                $(window).load(function() {                     $('.target').infinitescroll({                       navSelector  : ".navigation",                                                 // selector for the paged navigation (it will be hidden)                       nextSelector : ".navigation a.next",                                          // selector for the NEXT link (to page 2)                       itemSelector : ".post",                                                // selector for all items you'll retrieve                       debug : true,                       loading: {                           finishedMsg: '

All posts were loaded

',                           img: '',                           msg: null,                           msgText: "

"                         }                          }, function(arrayOfNewElems){                      $('.post').animate({"opacity":"1","max-height":"150px","padding":"15px 8px"},800, "jswing");                     }                      );               });      -If I call that script on page-a.php will only work on it, once page-b content is placed on  -If I call on page-a.php and page-b.php it works on first, then when first ajax content is loaded and then (if I apply a new filter) it won't work. -If I call the script on my ajax response function it will work once, then if I apply another filter and target div refreshes content, I get the  > Uncaught TypeError: Cannot call method 'appendTo' of null div classes called (.target and .post) are present on the page. What the hell am I doing wrong here. Thanks. PS: If you need to take a look at the real scripts let me know and I will provide.


Add scripts on custom post add/edit pages Not Working

im Trying to Add scripts on custom post add/edit pages but Not Working PHP Code ,(it's working and Get Js Code)               if(strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php')) {     wp_enqueue_script('myscript', 'http://exemple.com/wp-content/themes/theme/js/rt_api.js');      The Probleme is Js Code Not Give Result : Check my Js and HTMl Code


How to put a form with php code into a variable or shortcode?

I'm trying to put my frontend form into a variable or a shortcode so I can wrap another shortcode around it (specifically Bainternet Post Creation Limits). My form has PHP code in it so I'm not exactly sure how to do this. I have tried creating other variables for each line of PHP code but it's not working as I thought it might. I know how to create a shortcode; I don't know how to put a form with PHP into a shortcode though. I don't know how to put the form into a variable at all and I can't find information how to do this. Here's the form:               <form id="new_post" name="new_post" method="post" action="" class="submit-form" enctype="multipart/form-data">         <fieldset class="tax">             Class Price:                 <input type="text" value="" class="class" id="class" name="class" placeholder="20" /> €             Accent:                 <?php wp_dropdown_categories( 'tab_index=15&taxonomy=accent&hide_empty=0&name=accent&show_option_all=Select one' ); ?>
Rates

             Face-to-face classes             <?php                 $clocations = get_terms('class-location', 'orderby=id&hide_empty=0');                 $counter = 0;                 foreach ($clocations as $clocation) {                     $counter++;                     $option = '
<input class="checkbox" type="checkbox" name="class-location[]" id="'.$clocation->slug.'" value="'.$clocation->slug.'" onclick="enable_text(this.checked)" />';                     $option .= ''.$clocation->name.'';                     $option .= '<input type="text" class="rate" value="" id="'.$clocation->slug.'-rate" name="'.$clocation->slug.'-rate" disabled="disabled" /> €
';                     echo $option;                 }             ?>
                  <input type="submit" value="Add Teacher" tabindex="40" id="psubmit" name="submit" />         </fieldset>                  <input type="hidden" name="action" value="new_post" />             <?php wp_nonce_field( 'new-post' ); ?>          </form>      How do I put this form into a variable or a shortcode?


Query get post,how to add comment box

Hello I have a query that gets a post with id=x and it works but it leaves out the comment box. Is there a way to add "get comment box" to the query?               <?php      $post_id = 104;      $queried_post = get_post($post_id);      $content = $queried_post->post_content;      $content = apply_filters('the_content', $content);      $content = str_replace(']]>', ']]>', $content);      echo $content;       ?>


WooCommerce is slow with many categories

I'm struggling a bit with WooCommerce (and WordPress) being a bit slow. I have a development store for a customer with the following stats 5,319 Products 2,437 Product Categories Categories are hierarchical like this _/product-category/by-model/accord- ch1-1998-2003/body/accessories/_ The default /shop/ page (showing just sub- categories) takes 14 seconds to load. Stepping through the categories, each one takes less time to load. _/product- category/by-model/_ takes 6 seconds to load. _/product-category/by- model/accord-ch1-1998-2003/_ takes 1.5 seconds to load. _/product-category/by- model/accord-ch1-1998-2003/body/_ takes 1.5 seconds to load. None of those categories contain products, only sub-categories. And finally _/product-category/by-model/accord- ch1-1998-2003/body/accessories/_ the first category with any products in takes a more respectable 600 ms to load. Taking to load == time to first byte - once the server sends the data, we have DOM ready milliseconds later. The theme payload is about 500Kb per page. I was sure the issue was with the insane amount of SQL queries it does in the higher level categories. Before posting this, I moved the site from it's original home on a low-load, shared Dell R410 server to a VPS on similar hardware so I can mess with apache or MySQL a bit more. Server performance is good. Load is low. I've tried using an advanced-cache and an object-cache (both memcache based) and I don't see much gain. When I watch the general MySQL log I see these massive queries go past. None of them are slow according to the slow query log, I can only assume it is the sheer number of them, or the joins it does on the taxo tables. SQL caching is also enabled but doesn't seem to help much either. (All other pages load fast, just these Woo categories cause issues). Using SQL Profiler, I don't think it is SQL that is slow, more PHP sits at ~100% CPU load whilst WooCommerce does something. Total query time: 0.09768s for 89 queries. Page generated in 15.40064s (99.37% PHP, 0.63% MySQL) Has anyone experienced this kind of behaviour before? I'm running out of ideas rapidly! ## Edit I'm sure it is related to Woo looping over unnecessary terms The shop home page (/shop/) does a query like this http://pastebin.com/jsiaYenq TWICE! Which returns ~13,000 rows. Another similar query http://pastebin.com/B9xhFLFe returns almost the same number of rows. SQL returns these queries quick, however NewRelic proves that WooCommerce is trying to do something with these massive data sets, that consume 100% of the CPU and take ~25 seconds to complete. New Relic shows the app sits at the "woocommerce" stage for a long time. ![newrelic](http://i.stack.imgur.com/ZJATH.png) I'm convinced this is the problem!


Display users in order by an "order" custom meta field

Alright, so here's my current code (which works, displaying the users in order by ID and excluding the admin user):               $site_admin = "1";     $order = 'ID';     $user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->usermeta WHERE ID != '$site_admin' ORDER BY $order"); // query users     foreach($user_ids as $user_id) : // start authors' profile "loop"         $user = get_userdata($user_id);              $level = $user->user_level;         if ($level > 0)          { ?>              ((information to display goes here))             <?php  } ?>      What I'd like to do is add a meta field (I believe that's the right terminology, but please correct if wrong), and I have already added that, then type in a number for each author. Here's how that was added (in functions.php):               <?php function my_new_contactmethods( $contactmethods ) {     $contactmethods['order'] = 'Order on the About Page';      return $contactmethods;     }     add_filter('user_contactmethods','my_new_contactmethods',10,1);?>      Last, I'd like to display the users in that order. There are a number of related questions, but none that I could find that order the users by fields which are added in addition to the typical Wordpress user information (e.g. ID, user_nicename, etc.) I can simply replace "ID" in the code above with "user_nicename" and that works fine, but I need to be able to manually set the order of each of the users, so none of the built-in fields will work for that purpose.


Which image is used for thumbnail in List Category Post plugin

Which image does the plugin use for the thumbnail? From the customer field "thumbnail" or "featured-image"? What about an option to use "first attached image" or "first image in post" as some other plugins do?


Having separate plugins and themes folder for multi-site setup

My multi-site setup uses sub-directory. I am creating one plugin + one theme to customize each of the sites. Is there any way to have separate plugins and themes folder per site like so or something similar:               root     +----wp-content     |     +----site1     |          +----plugins     |          +----themes     |     +----site2     |          +----plugins     |          +----themes     +----mu-plugins     |     +----shared-plugin1     |     +----shared-plugin2     +----plugins     |     +----optional-plugin1     |     +----optional-plugin2        The goal is so that each site can only activate/deactivate the plugin/theme intended for it. **Edit** Multisite Plugin Manager can be a way to achieve what I want to do logically, though it does not put the plugins in their individual directories. I am still interested to hear other solutions.


Send mail to wordpress admin

I have a page on my wordpress site that has some fields to be filled by visitor. On the click event of 'submit' button, all the details filled by visitor should be mailed to the wordpress admin. I got to know how to Send automatic mail to Admin when user/member changes/adds profile but i don't have anything to do with the profiles right now. I want to send a mail to wp admin simply on button-click. Any help will be appreciated.


get the number of queries made on a page(inside my plugin)

Is there an easy way to see how many queries you make on a page(inside my plugin)? As I dont want to many queries in my plugin.


Help needed to make my site as Aggregator

I am having a doubt about using "Cron Job" . I have installed a Plugin named FeedWordpress which lets us to publish RSS feeds .It has given me an option to publish automatically or to publish by setting cron Jobs . Could any one guide me to set these Cron Job? I have no Idea on it .This is the message it given for that configuration . > If you want to use a cron job, you can perform scheduled updates by sending > regularly-scheduled requests to http://......?update_feedwordpress=1 For > example, inserting the following line in your crontab: > > */10 * * * * /usr/bin/curl --silent http://......?update_feedwordpress=1 > will check in every 10 minutes and check for updates on any feeds that are > ready to be polled for updates. I have another doubt .Is there any possibility to slow down and affects the load (It is of shared hosting ) ,if I turn on the Automatic Updates of feeds?How does it helps me If I use cron Job and put a cetain limit? So that it affects the server load only when It updates the feeds . Is there any chance to suspend my hosting account by Host If I Make my Blog as Aggregator because of high loads?


How do you add Read more ... link to posts?

How do you add Read more ...link to a particular post or to all posts in a blog ?


Best host for running large mem and processor intensive WordPress sites?

I host a number of WordPress sites, some of which have VERY large databases. I've gone through several popular web hosts though no joy yet. Any suggestions.


how can i add a menu link that goes to an external page

i started a new blog and i see that there are two pages it starts out with:   1. Home   2. About i want to add a third one but instead of having it load up an internal page, i want to have this go to an external link. is this possible ?


User-friendly cropping of post thumbnails?

Is there a way to let my users define the crop area of a post thumbnail? The thumbnails always are existing post attachments, I would rather not create an extra attachment per thumbnail. The post thumbnails should be 200x100 pixels, and come from one of the images used in the post. So in my ideal world, when you click the "Set Featured Image" link, you get an overview of the already included images, and when you click one of these, you can define the crop area yourself (moving or resizing it, but keeping the 2x1 aspect ratio). When you click "OK", the new post thumbnail is saved with the original attachment (in the `_wp_attachment_metadata['sizes']['post-thumbnail']` metadata field for example), not as a new attachment. Using an image that is already used as a post thumbnail for another post should not be allowed, or at least give a warning. I believe the included image editor will not suit my needs, since you can choose to edit all versions of the image, or the regular thumbnail, but not only the post thumbnail. I also find it a bit confusing to know what versions I am editing, so I think my users will have even more trouble with it. Is there a plugin that does what I want, or that I can easily extend to my needs? ## Update: Example UI I really like the interface of the Mac OS X Address Book image picker: you select an image, and resize a fixed ratio thumbnail cropper via a slider. You can also drag the base image around. You can expand this idea to multiple image sizes (I have a `post-thumbnail` and `post-thumbnail-1/2` that's half that size, for example). Let the user select the sizes (s)he is editing now with checkboxes, and draw the appropriate crop rectangles on the screen. ![The Address Book image cropper in action](http://i.stack.imgur.com/e5KiS.png)


Self Develop or Plugin as first option?

One of the things that attracted me to the WordPress platform was the plugin API and large selection, but more recently I have been self developing before looking for plugins, only using plugins for things that I don't feel I would be able to complete on time and in budget. So what do you do when you need functionality? Do you first think how you can do it yourself, or do you dive into the plugin repo straight away, the 'never reinvent the wheel' mentality? I think both have valid arguments.


What plugins are in use on wordpress.com

is there a list of plugins that are in use on WordPress.com somewhere? It would be very interesting to see how they have implemented specific widgets and functionality.


Is there a way (plugin?) to restrict a user to being able to edit just one page?

We use wordpress like a CMS and would very much like to allow users to have a "homepage". Ideally they'd be prevented from mucking up the whole site. Is there a simple way to limit users editing rights to a single page? I'm currently using the Members plugin to do other permission-based stuff, so it'd be great if a solution could either neatly augment this, or replace it entirely. Bonus points for automatic creation of a homepage when a new user is created. * * * UPDATES: I should clarify that these pages need to be confined to a specific area of the site (i.e. all children of the same page). Also, after speaking to some users it seems that they'd find it useful to create sub-pages branching from their home page.


I need to display post related info

WordPress CPT URLs are displayed at this format: www.example.com/cpt/post- slug. I need to have URL like this www.example.com/cpt/post-slug/rating that will include rating details for corresponding post-slug. For example: www.example.com/cpt/harry-potter/rating will display rating details for 'harry-potter' and www.example.com/cpt/abcdefgh/rating will display rating details for 'abcdefgh' I don't know what to name this functionality or how to do it :( Would you please share some opinion with me? --code for cpt named 'lessons'--               function register_lesson_init() {              $labels = array(                 'name'                => _x( 'Lessons', 'Lessons', 'text_domain' ),                 'singular_name'       => _x( 'Lesson', 'Lesson', 'text_domain' ),                 'menu_name'           => __( 'Lessons', 'text_domain' ),                 'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),                 'all_items'           => __( 'All Items', 'text_domain' ),                 'view_item'           => __( 'View Item', 'text_domain' ),                 'add_new_item'        => __( 'Add New Item', 'text_domain' ),                 'add_new'             => __( 'Add New', 'text_domain' ),                 'edit_item'           => __( 'Edit Item', 'text_domain' ),                 'update_item'         => __( 'Update Item', 'text_domain' ),                 'search_items'        => __( 'Search Item', 'text_domain' ),                 'not_found'           => __( 'Not found', 'text_domain' ),                 'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),         );         $args = array(                 'label'               => __( 'Lessons', 'text_domain' ),                 'description'         => __( 'Lessons Description', 'text_domain' ),                 'labels'              => $labels,                 'supports'            => array( 'title', 'editor', 'revisions', 'post-formats'),                 'taxonomies'          => array( 'es-lesson-topic' ),                 'hierarchical'        => true,                 'public'              => true,                 'show_ui'             => true,                 'show_in_menu'        => true,                 'show_in_nav_menus'   => true,                 'show_in_admin_bar'   => true,                 'menu_position'       => 5,                 'menu_icon'           => '',                 'exclude_from_search' => false,                 'publicly_queryable'  => true,                 'capability_type'     => 'page',         );         register_post_type( 'es-lesson', $args );}      i need to display related question page for this cpt url will look like: www.example.com/lessons/post-slug/question and I don't khow how to :(


Query to view scheduled or draft post

I have created a mailer template for my my single post. I can view the mailer version of my post using a url variable `?mailer` I've configured the above using the code below within my **single.php**...               if ( isset($_GET["mailer"]) ) {                get_template_part( 'mailer/template', 'post' );          } else {     /**      * @package WordPress      * @subpackage Josh 2014      * @since MyTheme 1.0     */     get_header();      Quite simple really. I then use the `get_permalink().'/?mailer'` which I then pass to campaign monitor to import my mailer template by url. Within my **mailer/template-single.php** I use this the basic loop to pull in my post data.               <?php              if ( have_posts() ) :                                                while ( have_posts() ) : the_post();     ?>          <!-- MY POST -->          <?php         endwhile;                                endif;     ?>      Everything above is working OK.    **My problem I have ran into today is with scheduled posts.** I would like to be able to view my post still (when not logged in) in the mailer template only, and not on the website. So I amended the code in my mailer template to this...               <?php              $args = array(                     'post_status' => array('publish','pending','draft','future','private')                 );              query_posts( $args );         if ( have_posts() ) :                                                while ( have_posts() ) : the_post();          ?>          <!-- MY POST -->          <?php         endwhile;                                endif;     ?>      I then visited my scheduled post permalink with my mailer variable in a new browser where I am not logged in. And I just get 404 error on my site.               http://www.mywebsite.com/scheduled-test-post/?mailer      So I'm guessing my query_posts above is not working. > Does any one have any ideas in how to amend my query to show scheduled posts > in my mailer template?


Permalinks all messed up, I am helpless

Today I tried to make the Permalinks of my Wordpress site more SEO friendly. I got it working for all links, except the ones linking to a custom post type page. I Googled the problem and found out that it's a common, in my eyes not- so-easy-to-solve-type problem. That's why I wanted to use the default permalink structure again (I am still in development phase). Now nearly all links are broken! Sometimes I get a 404, sometimes the browser itself says "page not found" - on some links, the default structure is still working. When I manually try to get to a page by entering the id manually in the brower's address bar, the address changes to the new structure, but I get a 404. You see, something is all wrong there and I don't really know how to fix it. I read about editing the .htaccess or httpd.conf (I'm in XAMPP) file, but because I don't know anything about this, I don't really want to change anything in there. Is there any way of "resetting" all permalinks to their default format? * * * **Edit:** Ok, according to the comments I should post the rewrite rules. _Problem:_ I don't even know what exactly to post from there! Plus one funny thing happened: I set the Permalink structure to `/%postname` again (since I am in 3.3.1 this should be alright I guess) and now it is working again. Only one link (the link to the custom-post type) is still ugly. So now I am in the same state as a few hours ago - although I still don't understand what is going on. When everything is correct, a URL looks like this: > http://www.example.com/kitchen But for a custom post type, the URL looks like this: > http://www.example.com/?food=food or when I visited > http://www.example.com/kitchen before that: > http://www.example.com/kitchen?food=food I use a the custom-post-type-ui plugin to create the post types. Please tell me what I should copy (I mean, that's a pretty long list right now...), then I will post it, but I just don't know right know. I guess that's why I can't even precisely describe the problem above, I am sorry! * * * **Edit:** The `.htaccess` looks like this:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]     </IfModule>     # END WordPress


Change description of my Jetpack facebook shared links

When I try to share a link from my WordPress site on facebook using the Jetpack Sharing Settings the link shows up like this:               (My Featured image picture here)          Put a hat on yo’ baby! | Trendz with Trina          http://www.trendzwithtrina.com/2012/02/0...          You may use these HTML tags and attributes: < a href="" title=""> < abbr title=""> < acronym title=""> < b> < blockquote cite=""> < cite> < code> < del datetime=""> < em> <i> < q cite=""> < strike> < strong>      How do I get rid of the "you may use blah blah blah" and have a description of my site or the post?


Using javascript on the new widget preview / customizer page

Widget customizer has just become core in WordPress 3.9. I'm trying out the beta version hoping to get widgets working on the customize screen in the same way I have on the ordinary widgets page. Some of my widgets use javascript, like a select element transformed using a jQuery plugin - called tokenInput. I need to be able to initialise the javascript on the new customizer screen where I can add / edit widgets.   * I can already initialise javascript on page load   * I can't reinitialise javascript on widget add, or on widget save. So basically when I click on a widget to add it, or when I save it, I lose the jquery plugin and it goes back to a normal select element. I solved this for the ordinary widgets page using something like this:               jQuery(document).ready(function() {                  // -------------------------------------------             // On page load             // -------------------------------------------             input.tokenInput("/search-posts.php");                  // ---------------------------------------------             // On new widget dropped in the sort area             // ---------------------------------------------                  jQuery(".widgets-sortables").on("sortreceive", function(event, ui) {                      setTimeout(function() {                           jQuery("#widgets-right .select_news_post:not(.token)").each(function(){                              var input = jQuery(this);                         input.addClass('token');                         select = input.next('select');                              input.tokenInput("/search-posts.php");                     });                 }, 500)             });                  // ---------------------------------------------             // On widget save             // ---------------------------------------------                  jQuery(document).ajaxSuccess(function(e, xhr, settings) {                      var widget_id_base = 'news-post';                 if (settings.data !== "undefined") {                          if (settings.data.search('action=save-widget') != - 1 && settings.data.search('id_base=' + widget_id_base) != - 1) {                              // jQuery Tokeniser                         jQuery("#widgets-right .select_news_post:not(.token)").each(function(){                                  var input = jQuery(this);                             input.addClass('token');                                  input.tokenInput("/search-posts.php");                         })                     }                 }             }     }      Does anyone have any idea what I would use on the widget customizer page to make it reinitialise the javascript on add new widget and save widget?


How to create category index table out of wordpress site or on other website?

I want to create a page on other part on my website (outside wordpress directory) where I can show list of posts from a specific category.   I am looking for exact solution provided by @toscho here: How to create tabled index of posts in a certain category For example, if my wordpress site is `example.com/blog/`, I want to create a standalone solution (php script) which will show list of posts from the wordpress site based on the category. Something like: `example.com/category.php`. Is this possible with RSS or any other solution?


Buddypress Registartion template

How do I create a registration template in Buddypress? I can't seem to find any way to integrate the registration form in a template page. I tried adding this code to my template page, it displays nothing but a blank form: http://pastebin.com/QsL65A53 Can anyone tell me what I am doing wrong? **UPDATE:** * * * Now I have this in my front-page.php file: http://pastebin.com/ZeK43zkv It shows all the fields but doesn't work. When I click the signup button it returns the same page and does not register the user. Anyone?


How to prevent a page from being linked in the menu/crossbar

I apologize if the question is confusing. Let me explain: I'm running a modified version of Twentyten and I've been doing the parent/child thing with my pages, which show up on the horizontal menu that I like to call the crossbar. However, I want to add pages that are not linked to from there, only from a sidebar widget. Unfortunately, I am not at all fluent when it comes to PHP...I've been trying to learn. Does anyone understand what I'm trying to do/have a solution? EDIT: I ended up just making a seperate html document that uses the stylesheet and linked to it. Is there an outstanding reason NOT to do this?


submit button not work

i try make 2 submit button in admin post edit page i try this               function extra_fields_box_func2( $post ){          $user = get_current_user_id();          $change_user = get_post_meta($post->ID, 'change_author', true);          if ($user==$change_user){               echo'<form method="post">';               echo'<input type="submit" name="save" value="Принять" />';               echo'<input type="submit" name="reset" value="Отклонить" />';               echo'</form>';               if (isset($_POST['save'])) {                  error_log('save');                  $res='yes';                 }               else               if (isset($_POST['reset'])) {                   error_log('delete');                   $res='no';                 }               if (isset($res)){               changenotice($post_id, $res);               }             }     }      and i try this code               function extra_fields_box_func2( $post ){     ?>     <form method="post">     <input type="submit" name="save" value="Принять" />     <input type="submit" name="reset" value="Отклонить" />     </form>     <?php          $user = get_current_user_id();          $change_user = get_post_meta($post->ID, 'change_author', true);          if ($user==$change_user){               //echo'<form method="post">';               //echo'<input type="submit" name="save" value="Принять" />';               //echo'<input type="submit" name="reset" value="Отклонить" />';               //echo'</form>';               if (isset($_POST['save'])) {                  error_log('save');                  $res='yes';                 }               else               if (isset($_POST['reset'])) {                   error_log('delete');                   $res='no';                 }               if (isset($res)){               changenotice($post_id, $res);               }             }     }      but is not work, debug.log is empty, what i make wrong ?


Listing Pages With Checkboxes In a Metabox (and saving them)

Here is what I'm basically trying to accomplish:   1. I have a custom post type called 'quotes'   2. I have a number of wordpress pages What I am trying to do is this: each time when I create a new "QUOTES" post, I want to be able to choose on which page this quotes post is supposed to go. I've decided to do this by creating a new metabox on the "quotes" post page and listing in that metabox all the pages, with a checkbox in front of them: ![pages listing metabox screenshot](http://i.stack.imgur.com/GYLT5.jpg) All fine and well, but now I don't know how to save these checkboxes. Here is the function I use to print the content of the metabox:               function myplugin_inner_custom_box( $post ) {         $custom = get_post_custom($post->ID);         $checkfield = $custom["checkfield"][0];              // Nonce to verify intention later         wp_nonce_field( 'save_quote_meta', 'custom_nonce' );          $pages = get_pages();               foreach ( $pages as $page ) { ?>                <input type="checkbox" name="checkfield_<?php echo $page->ID; ?>" value="yes" <?php if ($checkfield == 'yes') { ?> checked <?php } ?> /> <?php echo $page->post_title; ?> <br>            <?php          }      }      And here is the function I use to save them:               //save the meta box action     add_action( 'save_post', 'myplugin_meta_save' );          //save the meta box     function myplugin_meta_save()     {         global $post;         update_post_meta($post->ID, 'checkfield', $_POST['checkfield'] );     }      Obviously this doesn't work - I am not sure how to save all those checkfields values.


How do I use fetch_feed() to pull in a large number of posts?

When I use fetch_feed() to pull in posts from a feed, even if I set the maximum posts variable to a very high number, it will only pull in 10 posts. I want to pull in all the posts and then paginate the way I would for my regular blog posts. I thought maybe it was set to the number in my Reading settings, but I changed it to 30 with no change. There are definitely more than 10 posts in the feed I am trying to pull in. Is this possible or is this inherently limited for this function?


2 different post->IDs for single page load only in Firefox

I am saving the post->ID in a session array to keep a history of the accessed pages for a specific custom post type. This code was added to that specific custom post type's template, so that the session data only updates for requests for this type. So, if the user loads the page with postID 1, then "1" is saved in the session. If he then loads a page with postID 5, then "5" is added to the session, resulting in array(1, 5), and so on. This works just fine across all major browsers with the exception of FireFox (Windows & Mac). For some reason the initial session is saved properly, but the next time I reload the same page, it will suddenly show for example array(1, 5) even though only postID 1 was accessed. I added logging to the script to log whenever the session data gets updated and that's when I noticed that for some reason FireFox sends like a partial request (faster than full page load) before loading the actual post, e.g.:   1. user loads page with postID 1, session gets updated with array(1)   2. user hits reload, FireFox loads postID 5 and then loads postID 1 again, resulting in array(1, 5) This extra page load is not visible and also doesn't show in Firebug, but somehow FireFox sends those multiple page requests even when just reloading a single page. I have already ruled out the code, since it's working fine in all other browsers and I also disabled all plugins/addons but it still happens even in vanilla FireFox. Plus it's cross-platform, so happens on a mac & windows PC when using FireFox. Has anyone experienced a similar issue before?


How can I add buttons to a custom column in the taxonomy table?

I am working on an **issue-based publishing system** for a friend of mine. So far I have created a custom taxonomy called "Issue"; added several custom fields to the custom taxonomy (like "Issue number", "PDF URL" and "Is Published?"); and expanded the taxonomy management page with additional columns to show these custom term data. Now I want to implement a convenient method to publish (and unpublish) the individual issues. My plan is to **add an additional custom column to the taxonomy management page which contains "Publish" and "Unpublish" buttons**. So I tried to populate the custom column with a form which contains hidden data fields and a visible submit button; basically I duplicated the functionality of the default term edit form, and put it in the table cells. The problem is that the whole taxonomy management table is wrapped in a form, called "posts-filter", and **forms cannot be nested**. So my solution doesn't work properly. Is there a proper solution for adding such buttons to a custom column? Any suggestions are welcomed! An image for clarification: http://img845.imageshack.us/img845/669/customcol.png               add_filter("manage_issue_custom_column", 'manage_issue_columns', 10, 3);          // The function that manages the custom columns     function manage_issue_columns($out, $column_name, $issue_id) {         $issue = get_term($issue_id, 'issue');     switch ($column_name) {         case 'issue_pdf_url':             $term_meta = get_option( "taxonomy_term_$issue_id" );             if ( isset( $term_meta["issue_pdf_url"] ) ){                 $out .= $term_meta["issue_pdf_url"];              }            break;              case 'issue_num':             $term_meta = get_option( "taxonomy_term_$issue_id" );             if ( isset( $term_meta["issue_num"] ) ){                 $out .= $term_meta["issue_num"];             }         break;              //This is the column where I need to add buttons         case 'issue_published':             $term_meta = get_option( "taxonomy_term_$issue_id" );             $term_object = get_term($issue_id, "issue");             if ( isset( $term_meta["issue_published"] ) && $term_meta["issue_published"] == "yes" ){                 //This is the form which shows the publishing buttons; not working due to being nested in other form                 $out .= '<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="">  <input type="hidden" name="action" value="editedtag" />  <input type="hidden" name="tag_ID" value="' . esc_attr($issue_id) . '" />  <input type="hidden" name="taxonomy" value="issue" />  ' . wp_original_referer_field(true, 'current') . wp_nonce_field('update-tag_' . $issue_id) . ' <input name="name" id="name" type="hidden" value="' . $term_object->name . '" />  <input name="slug" id="slug" type="hidden" value="' . $term_object->slug .'" />  <input name="description" id="description" type="hidden" value="' . $term_object->description .'" />  <input type="hidden" value="" checked="" id="term_meta[issue_published]" name="term_meta[issue_published]">  <input type="submit" value="Unpublish" class="button-primary" id="submit" name="submit"></form>';             } else {                 $out .= '<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="">  <input type="hidden" name="action" value="editedtag" />  <input type="hidden" name="tag_ID" value="' . esc_attr($issue_id) . '" />  <input type="hidden" name="taxonomy" value="issue" />  ' . wp_original_referer_field(true, 'current') . wp_nonce_field('update-tag_' . $issue_id) . ' <input name="name" id="name" type="hidden" value="' . $term_object->name . '" />  <input name="slug" id="slug" type="hidden" value="' . $term_object->slug .'" />  <input name="description" id="description" type="hidden" value="' . $term_object->description .'" />  <input type="hidden" value="yes" checked="checked" id="term_meta[issue_published]" name="term_meta[issue_published]">  <input type="submit" value="Publish" class="button-primary" id="submit" name="submit"></form>';             }         break;              default:         break;     }          return $out;     }


Wordpress auto login after registration not working

So I looked up a bunch of threads trying to figure out how to automatically log a user in after registration, and came up with this.               function log_me_the_f_in( $user_id ) {         $user = get_user_by('id',$user_id);         $username = $user->user_nicename;         $user_id = $user->ID;         wp_set_current_user($user_id, $username);         wp_set_auth_cookie($user_id);         do_action('wp_login', $username, $user);         exit;     }     add_action( 'user_register', 'log_me_the_f_in' );      According to many responses I've seen, `wp_set_auth_cookie` and `wp_set_current_user` alone should be enough to log a user in by id, but even this isn't doing anything. Does anyone have any idea what I'm doing wrong?


Making footer widgets responsive

I have 4 footer widgets in the theme I'm working on. It works great. The only thing that I can't get to work is the responsiveness of the widgets. The 4 footer widgets keep on showing up next to each other on smaller screens, and I need them to be on top of each other for smaller screens. Can any one help me around this problem. Here is my code :               <div id="footerwidget" <?php pietergoosen_voet_widgets_klas(); ?>>     <?php if ( is_active_sidebar( 'sidebar-15' ) ) : ?>
         <?php dynamic_sidebar( 'sidebar-15' ); ?>
     <?php endif; ?>          <?php if ( is_active_sidebar( 'sidebar-16' ) ) : ?>
         <?php dynamic_sidebar( 'sidebar-16' ); ?>
     <?php endif; ?>          <?php if ( is_active_sidebar( 'sidebar-17' ) ) : ?>
         <?php dynamic_sidebar( 'sidebar-17' ); ?>
     <?php endif; ?>          <?php if ( is_active_sidebar( 'sidebar-18' ) ) : ?>
         <?php dynamic_sidebar( 'sidebar-18' ); ?>
     <?php endif; ?>


WXR? Export from Drupal 7 - import into WordPress

I have used some of the tutorials out there to convert a Drupal 7 site over to WordPress. My problem is that I am not finding any tutorials with the lines I can use in my MySQL to convert the users,comments,tags,category table in Drupal 7 over to the wp_users table in WordPress 3+. As I said... everything else has converted perfectly, but this is the only thing left.


Programmatically create blogs with dummy content on a WPMU site

I'm trying to set up a WPMU test environment with 5-6K blogs, lots of posts comments, users etc. Browsing trough the WP's functions, I picked up wp_insert_post, wp_insert_comment, create_empty_blog(), and wp_insert_user(). So basically I would run a big for loop in which I create random blogs, get their ID, switch to each of them and insert posts with random content. Is this really this easy as it looks? :) Or I'm missing something here?


Remove the number of posts displayed in wp_list_categories()

When I use wp_list_categories(), it results in the number of posts in a category being shown, how do I hide the number? For example: I have xyz category, it has 3 posts, the result will be:               xyz(3)


Get search term not on searh results page?

I would like to get the last term that was searched, but when not in the search.php page. For that, I know, I could use **get_search_query()** function, but if user clicks on a post for example, so he is now in the single item and that function will retrieve an empty string. I want to preserve that search phrase and get it on other page. Any ideas? Thanks


Warning: Cannot modify header information - How to resolve this issue?

What is the wrong with this code. I am always getting the error like: > Warning: Cannot modify header information - headers already sent by (output > started at /home/krishnas/Documents/wordpress/wp-admin/menu-header.php:91) > in /home/krishnas/Documents/wordpress/wp-includes/pluggable.php on line 866               $upload_dir = wp_upload_dir();             $basedir = $upload_dir['basedir'];             $baseurl = $upload_dir['baseurl'];             $filename = "products_".date('YmdHis').".xls";             $fp = fopen($basedir.'/'.$filename,'wr');             fwrite($fp,$content_final);             $excell_file = $baseurl.'/'.$filename;             //echo $basedir;             //echo $baseurl;             //exit;             //exit;             wp_redirect($excell_file);exit;}}?>


How to add a full edit link to front-end editor?

I would like to add a full edit button to the Front-end Editor plugin. It's currently like this: > [EDIT] Text text text I would like to make it like: > [EDIT] Text text text (enables front-end editor) > > [FULL EDIT] Text Text Text (goes to the back-end editor) I think this is the current code for the [EDIT] button: `wp-content/plugins/front-end-editor/build/editor.min.js`:               base.prototype.pre_edit_button = function() {           var _this = this;           return jQuery('<button>', {             'class': 'fee-hover-edit',             'html': FrontEndEditor.data.edit_text,             'click': function(ev) {               _this.last_mouse_pos = ev.pageY;               return _this.start_editing();             }           });


How to deal with equal & similar arguments for a function?

I'm currently extending my pagination plugin, after a hint by @toscho. So the plugin will now use the same filters, hooks and arguments as the native wordpress pagination functions. My problem is that the different wp functions name their arguments ... different. ### Example: _This is how you change the text for the "Next" link._   * `wp_link_page()` = `'nextpagelink'`   * `paginate_links()` = `'next_text'` After retrieving the input in the class, I `wp_parse_args( $args, $this->defaults );` my arguments and then `extract` them. ### Problem: When I now allow both `'nextpagelink'` & `'next_text'` as valid arguments, how would i deal with them? Which would I check first? Do I need to set some priority, so one overrules (if both are set) the other? ### Example: This example shows my dilemmas:   * Which one has the higher priority? How can I avoid deciding?   * It's really long code just for deciding what to do with 2 vars. Code:               if ( $nextpagelink && $next_text )      {         // CASE 1: both are set         // which one should I take now?     }     elseif ( $nextpagelink )     {         // CASE 2: only one is set - should this one override the next one?         // set something     }     elseif ( $next_text )     {         // CASE 3: only one is set - should this be overridden by the previous one?         // set     }     else     {         // CASE 4: none is set - apply default         // set default     }


Switched server & domain name, now custom post types won't save

I had the site on oldsite.com but was using the database at newsite.com, everything was working great. I moved the site to newsite.com, now when I try adding a new post using a custom post type, it disappears, I am still able edit older posts, of the same custom post type. I checked the db when I create a new post nothing is saved, when I make changes to existing posts the change is saved. Not sure where to look next. Thanks this is in my functions.php http://pastebin.com/n5baM3R8


How do I embed youtube video via url in frontend posting

I would like to embed videos & images by entering url in my wordpress site. In WordPress repsitory there are many plugins for embed video by url but in my site I want to enable this functionality from frontend. Registered users can be able to enter a url and this video will enbed in the post. How can I achieve this.


Auto log in hook is requiring a page refresh

I have a simple auto log in hook that looks like the following:               function auto_login() {         if (!is_user_logged_in()) {             //Removed some code for brevity.                  $user = get_userdatabylogin($domainName);                  if ($user != null) {                 //Set the auth cookie.                 wp_set_auth_cookie($user->ID, false, null);                 //Set the current user (this will also set WP objects at the global level)                 wp_set_current_user($user->ID);             }         }     }     add_action('init', 'auto_login');      This code does work, but, in order to get the admin bar at the top of the page it requires a page refresh. This makes me think that I'm not getting some global objects populated early enough in the Wordpress page life cycle. Should I be calling this method somewhere else besides `init`?


Display Headings on Index page in different font sizes

The index page of any wordpress blog has a same size of font in their heading. Can't we tailor size of headings by ourselves for each post? If we change it by CSS, every heading will be changed. Or may be we can create a shortcode for it? Any clues to get started?


Nested WP_Query breaking loop

I'm using `WP_Query` to get all pages without subpages. For each page I'm using again `WP_Query` to get all child pages of the current page inside the first loop. This all works fine and I'm getting the expected result. But when now using a third `WP_Query` on one of the sub pages, the second level loop breaks. I already tried the functions `wp_reset_query()` and `wp_reset_postdata()` but they didn't do the trick. Also I tried to save the `global $wp_query` and `global $post` and reset them after the loop, but this didn't help too. How do I implement nested queries in WP? **Edit** As requested (and how it would have been correct) here is my code. I also realized that my problem does not apply only to the third, but also to the second loop.               $all_pages = new WP_Query(array('post_type' => 'page', 'post_status' => 'publish', 'post_parent' => 0));          while($all_pages->have_posts()) {         $all_pages->the_post();         include(get_page_template());     }          wp_reset_postdata();      In the page templates I'm using the following code to get child pages:               // child page content rendered here, depending on template          if($post->post_parent == 0) {         $child_pages = new WP_Query(array('post_type' => 'page', 'post_status' => 'publish', 'page_parent' => $post->post_parent));              while($child_pages->have_posts()) {             $child_pages->the_post();             include(get_page_template());         }              wp_reset_postdata();     }      I can execute WP_Queries on the child pages. But when then using `the_post();` the `$child_page` loop stops executing.


Random Default Avatar Function

UPDATE! After a little help from the wordpress.org forums, I made some progress with this code:               // Custom Default Avatar          if ( !function_exists('fb_addgravatar') ) {     function fb_addgravatar( $avatar_defaults ) {     $myavatar = get_bloginfo('template_directory') . '/images/avatars/avatar_' . (string) rand(1,5) . '.png';     $avatar_defaults[$myavatar] = 'Users';     return $avatar_defaults; }     add_filter( 'avatar_defaults', 'fb_addgravatar' ); }      Adding that to my functions.php file will allow me to choose my custom avatar "Users" in the Discussions panel, and it WILL show up for commenters who do not have there own Avatar. However, so far it is using the same image for all commenters. Ideally, I would like to go to discussions, choose "Users" at the bottom of the Avatar list, and have a random image for each commenter who does not have their own. I'll be using small record covers. So you would see a comment section with say, 5 different record covers mixed in with people who have an actual Avatar. I had this working 3 or so years ago, but it is not proving so easy this time. Again, all help is GREATLY appreciated.


How to duplicate the media upload insert media tab?

I'm currently trying to add custom functionality to the media uploader from my plugin... I basically need to be able to duplicate the functionality that is used to run the `Insert Media` tab on my own custom tab. I was able to find how to make a custom tab using the following code:               // Add new submenu to media upload screen     add_filter( 'media_upload_tabs', 'DSkills_media_upload_tabs' );          function DSkills_media_upload_tabs( $tabs ) {         $tabs['flickr_uploads'] = "Flickr Uploads";         return $tabs;     }          // Include necessary files so this works     wp_enqueue_script( 'media-upload' );          // Construct the custom media upload form     function upload_flickr_uploads_tab() { ?>              <!-- Content to include -->         <div class="flickr-uploads">              </div>          <?php }          // Activate and insert the iframe     add_action( 'media_upload_flickr_uploads', 'upload_flickr_menu_handle' );          function upload_flickr_menu_handle() {              return wp_iframe( 'upload_flickr_uploads_tab' );     }      But, even after spending hours researching the subject I still was unable to find a solution. I need the solution to be mainly in `php / jQuery`. Any and all help or even suggestions on where to look for a solution is greatly appreciated!


Adding Custom Javascript to Skeleton Child Theme

I'm trying to register & enqueue ImageMapster in my Skeleton Child Theme on the main.php page to make an image map with hovering image effects. I added this code to the "Header Functions" section of my child theme's functions.php file:               add_action( 'wp_enqueue_scripts', 'load_custom_js' );     function load_custom_js() {         wp_register_script( 'jquery.imagemapster.js',          get_template_directory_uri() . '/javascripts/jquery.imagemapster.js',          array('jquery'), '1.2.6', false );              if ( is_page('Main') ) {         wp_enqueue_script( 'jquery.imagemapster.js',          get_template_directory_uri() . '/javascripts/jquery.imagemapster.js',          array('jquery'), '1.2.6', false );         }     }       Now my site has ceased to work. The javascript file is located in the parent theme directory, so is it correct to use get_template_directory_uri instead of get_stylesheet_directory_uri? Does each theme have a particular place where one should add custom functions or am I correct in adding it under "Header Functions"? Any help would be appreciated.


WordPress AJAX Pagination with query_posts

I have a list checkbox categories, which when checked, use WordPress's admin- ajax.php to filter posts to the selected category. All is working great, however, I am struggling to get the updated pagination. I'm using query_posts as follows:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args= array     (      'post_type'=>'course',         'paged'=>$paged,         'posts_per_page'=>3,       'tax_query' => array(          array(         'taxonomy' => 'subject',         'field' => 'slug',         'terms' => $tags_from_group         )         )          );          $posts=query_posts( $args);      I then pass the $posts back as data, but I don't know how to access the updated pagination.. I was thinking something along these lines:                $pagedposts=array();      $pagedposts['posts']=$posts;      $pagedposts['pagination']=???      So $pagedposts['pagination'] would be the data needed to update the old pagi after the ajax call is successful.. I found someone else had this problem here, but there is no solution there...


Wordpress Admin Tables in Post View

I'm trying to add my custom Wordpress table (similar to the links table) into the "New Post" view of a custom post type. I hope that makes sense.


Create a permalink for a post's attachments

I'm trying to create a custom permalink structure. I'd like to have a custom page which displays each post's image attachments, using the following structure: _www.mysite.com/hello-world/images_ If anyone visited this URL, it would serve up a page of images that are attached to hello-world. It's kind of like having a subpage I guess, but I'd want it for posts (not pages) and I'd want it to be automatic. I have a template .php coded-up for this purpose; it will grab all attached images and display them. I'm just looking for a way that people can get to it via the above URL structure. I'm not sure how to go about doing this ie. if there's an easy way in Wordpress, or if I need to look into Rewrite rules in my .htaccess. Any thoughts would be appreciated, thanks -


Fancybox 1.3.4 : how to disable effect on gallery?

A plugin I have installed use fancybox 1.3.4. Yeah I know, pretty old... On galleries, between images, the fancybox applies a kind of transition effect. I cannot disable it. Here is ma javascript code :               jQuery(document).ready(function($) {             $("a.fancy").fancybox({                 "width" : 900,                 "height" : 600,                 "autoScale" : true,                 "openEffect" : "none",                 "closeEffect" : "none",                 "nextEffect" : "none",                 "prevEffect" : "none",                 "transitionIn" : 'none',                 "transitionOut" : 'none',                 "titleShow" : false,                 "openEasing" : 'none',                 "closeEasing" : 'none',                 "nextEasing" : 'none',                 "prevEasing" : 'none'             });      Any help would be much appreciated !!!


Max Posts and Memory Limit

So I have a custom post type which uses ACF Metaboxes that contains over 750 posts and grwoing. I got the infamous white screen of death because it seems like PHP has exhaused it's memory limit querying all these posts and data. I set my PHP.INI file's max execution time and memory limit to `-1` and increased my WP's memory limit in config to `define('WP_MEMORY_LIMIT', '4096M');` yet I'm still receiving a white screen of death in the admin when trying to view the custom post type. Any ideas on how to fix/increase memory? Thanks


Twenty Fourteen responsive CSS

I today install on wordpress new responsive theme ''Twenty Fourteen'', I try to edit css, try to change bg color of header menu, I can't found in css where i change bg color, I before do this a million times on old not responsive css, how i edit responsive css ? Thanks.


Date when the custom field was added

I have a couple of custom fields setup and working fine, is there any way to show the date when the custom field was created within the post template? I tried searching around, but no luck. For example:               name: test1 - value: result1     -------- created 10/02/09     name: test2 - value: result2     -------- created 15/03/10      Thank you.


How to redirect new WordPress user to previous page after registering

When a user registers for a WordPress site, they are redirected to the login page after completing the registration form. Is there a way to redirect them to the previous page before filling out the registration form? Please note that I'm not looking for a custom/static page because the user will be coming from various pages and that's the page I want them to return to - not the same page for every case. Thanks!


tax_query operator issue. IN works, AND never returns any results

This is a bit complicated. I have a wp_query that is almost working perfectly, but I have one issue. I think there is something here that I'm just not seeing. All of my code is an included php file in index.php. I have three custom taxonomies and a form that is sending POST variables to the same page when submitted. Here's a simplified version of the form.               <form name="filter" method="POST">
Topics

Compliance <input name="topics[]" value="compliance" type="checkbox">

Regions

Americas <input name="regions[]" value="americas" type="checkbox">

                                    <input type="hidden" name="filter" value="yes">           <input type="submit" value="Filter">     </form>      The form seems to submit all of the values just fine. Then, after checking if the form has been submitted, I run this code:               // Get arrays from posts     $topics = $_POST['topics'];     $industries = $_POST['industries'];     $regions = $_POST['regions'];          // This part builds arguments for the filtered query.     // It will only build the array if they are set     if (isset($topics)) {       $array1 = array(                 'taxonomy' => 'topics',                 'field' => 'slug',                 'terms' => $topics,                 'operator' => 'IN'             );     }     else {$array1=NULL;}          if (isset($industries)) {       $array2 = array(                 'taxonomy' => 'industries',                 'field' => 'slug',                 'terms' => $industries,                 'operator' => 'IN'             );     }     else {$array2=NULL;}          if (isset($regions)) {       $array3 = array(                 'taxonomy' => 'regions',                 'field' => 'slug',                 'terms' => $regions,                 'operator' => 'IN'             );     }     else {$array3=NULL;}      Then from those three arrays, I build the query.                   // Build the Query         $args = array(         'post_type' => 'post',         'tax_query' => array(             'relation' => 'AND',             $array1,              $array2,             $array3         )     );     $the_query = new WP_Query( $args );      Then, of course, I run my loop. Now, since the 'relation' argument in the query is set to 'AND', if one taxonomy term is submitted from each of the three taxonomies (or just from two of them), then only posts that have all of those terms will be returned. I want to make this work the same way within a taxonomy. So if you submit two terms from one taxonomy, it will only return posts that have both of those terms set. So I should be able to just change 'operator' in my array from 'IN' to 'AND'. However, when I do that, I never get any results. Even if I submit two terms that I know should have a result. What am I missing? Is there something else I need to do to make the 'AND' operator work? Thanks!


Compare revisions on pending posts doesn't work for authors and lower

I'm using map meta cap to allow extra permissions (edit/publish/edit_others/read_private/edit_private) if the user and post share a category. Comparing revisions doesn't work beyond the first comparison for a pending post if the user type is author or lower. The same user can view all the compare revisions if the post is either published, or if their role is changed to at least Editor, meaning they can only view edit because of map meta cap. The user has the ability to view one set, and if I get the changed url from a user who can see all the revisions, I can view that set, but am unable to switch between using the javascript slider/buttons. It just says "Sorry, something went wrong. The requested comparison could not be loaded." I'm wondering if there is a capability I need to change in order to have my custom role be able to view all the revisions, javascript I need to change to take into account the map meta cap, or if there is something else going on.


Execute Jquery when a specific page in my plugin is loading

I am building a plugin and I would like to be able to hide the wordpress admin side menu and top bar when a specific page is shown(or menu item clicked)? Should I call the jquery directly as a script on the plugin page's code, or is there a way I can execute the jquery when the page is loading, or menu item is clicked from a hooked function with ajax or something similar? Here is the jquery I wan't to run:               $("#wpadminbar, #adminmenuwrap").hide();


Add access control origin header information across multisite

I want to add the below snippet to my wordpress installation.               <?php header("Access-Control-Allow-Origin: *");?>      I don't want to add it in every template header as there are many of them and I have 60 networks with 2-3 sites in each network. In what file should I add this snippet so that it has effect across the entire wordpress installation?


Some Pemalink problems, probably caused by wrong .htaccess configuration?

I have import on my local webserver a backup of a website made using WordPress but I am finding some difficulties with **PermaLink** configuration The main problem is that if I use the permalink setted as Article Name I can see the homepage but if I click on the articles links into the homepage (to see the article) I always obtain the following message error: > Not Found > > The requested URL /wordpress35/2012/10/11/se-milano-avesse-il-mare-anzi-no- > la-montagna-di-campiglio/ was not found on this server. If I instead I use the Default settings for permalink (`http://localhost/wordpress35/?p=123`) I have no problem and I can access to the articles in my website I think that this is a **.htaccess** problem. Can you help me to create an **.htaccess** file that solve this problem? This is my actual **.htaccess** file content:               # 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]     </IfModule>     # END WordPress      I need to use the URL format described as: `http://localhost/wordpress35/my- article-name`


How many MySQL queries per visit I should normally have?

Hi, I have 170 MySQL queries per visit. Is that OK? Thanks. ![enter image description here](http://i.stack.imgur.com/XGkko.png)


Remove or Edit <dc:creator>in Feeds

Would like to remove or edit it to be a static value without editing core Wordpress files. Preferably as a function.


How do I combine these 2 queries

I want to combine the 2 following queries so that ongoing promotions (query 1) shows before the rest of the promotions (query 2) but all together no more than 5 results show. Thanks. Query #1 Ongoing Promotions               <?php         global $post;         $args = array(             'post_type' => 'promotions',             'numberposts' => 5,             'meta_key' => 'sp_ongoingPromotion',             'meta_value' => 1         );         $supplierCommunications = get_posts( $args );         foreach( $supplierCommunications as $post ) :   setup_postdata($post);     ?>
         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                      <?php                 echo "Ongoing Promotion";             ?>
     <?php endforeach; ?>     <?php wp_reset_postdata(); ?>      Query #2 Current Promotions                           <?php                     global $post;                     $args = array(                         'post_type' => 'promotions',                         'numberposts' => 5,                         'meta_key' => 'sp_endDate',                         'meta_value' => date("Y/m/d"),                         'meta_compare' => '>=',                         'orderby' => 'meta_value',                         'order' => 'ASC'                     );                     $supplierCommunications = get_posts( $args );                     foreach( $supplierCommunications as $post ) :   setup_postdata($post);                 ?>
                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                              <?php                             $meta = get_post_meta(get_the_ID(), 'sp_endDate', true);                             if('' != $meta) {                                 $formattedDate = new DateTime($meta);                                 echo "Expires: ".$formattedDate->format('F d, Y');                             }                         ?>
                 <?php endforeach; ?>                 <?php wp_reset_postdata(); ?>


add_filter with retrieve_password_message() not working in plugin, but works in functions.php

I'm trying to use retrieve_password_message to change the lost password email. The problem is that when I use it in a theme's functions.php, it works great, but when I put it into my (activated, working properly in other ways) plugin, it doesn't work. Does anyone know why? I have the priority set as 1.