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

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

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

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

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

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


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

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


How to Require a Minimum Image Dimension for Uploading?

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


A custom jquery posts slideshow?

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


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

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


Star rating for custom post types

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


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

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


How to get pages id in array in get_pages?

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


Limiting title characters in the AZIndex plugin

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


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

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


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

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


How to use get_template part in the plugin?

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


How do I manage my users post before publish?

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


Plugin development with unit tests

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


get_template_directory vs get_stylesheet_directory

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


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

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


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

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


How does WooCommerce display a custom comment_type in Comment Admin?

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


Admin Menu new tab external link

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


no emails for a user account

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


Make slug as ID Number for custom post types

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


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

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


How to customize woocommerce single-product.php tabs

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


Disable WooCommerce SKU on Product Page

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


How to cache custom pages using W3 Total Cache?

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


How to increase password requirements for registration

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


Login redirect to previous page

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


Methods to display images without plugin?

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


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

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


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

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

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

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

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

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

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


Unable to show messages using 'admin_notices'

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

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

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

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


Auto Populate Excerpt Field

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


Inserting specific images inside navigation menu

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


Lock user information once fields have been filled in

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


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

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


how to remove user name and date in post page

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


Redirect User to custom URL after registering

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


web.config breaks the themes for sub-directory multisite

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


P3 Profiler and Yoast SEO plugin

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


How to show a users bio on a page

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


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

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


wordpress Static Page pagination

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


How to use update_post_meta inside wp_trash_post

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


run script on publish

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


Why use while over if in single wordpress posts?

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


Copying database tables to new database

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


How can I allow commas in tag names?

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


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

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


how woocommerce swatch color name when hovered or selected

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


Im using a right approach to use this class inside WordPress theme?

I'm using a class to retrieve values from custom tables that I need to use in different files of my WordPress Theme and im not sure which is the best approach for this. This is the class i got right now (dont blame as im a bit noob :D)               class Plans {              public $free_plans;         public $purchased_plans;              private $free_count;         private $purchased_count;                   public function __construct(){             global $current_user;             $this->user_id= $current_user->ID;             $this->free_plans();             $this->purchased_plans();         }             public function free_plans($debug=false){             global $wpdb;             $free_plans =  database query here;             $this->free_count= count($free_plans);             if($debug) $this->debug_wpdb();              $this->free_plans= $free_plans;         }              public function purchased_plans($debug=false){             global $wpdb;             $plans_purchased= database query here;             $this->purchased_count=count($plans_purchased);             if($debug) $this->debug_wpdb();              $this->purchased_plans= $plans_purchased;         }              private function debug_wpdb(){             global $wpdb;                 $wpdb->show_errors();                   $wpdb->print_error();              }              public function get_pplans_count(){                      return $this->purchased_count;         }              public function get_fplans_count(){                      return $this->free_count;         }              public function get_purchased_plans(){                      return $this->purchased_plans;         }              public function get_free_plans(){                      return $this->free_plans;         }          }      I need to use this functions all around my theme (header.php , page- custom.php, etc) and i just want to use one instance of the class as i dont want to query database every time i need one value because querying just two like i do when i create the class is enough. Now where should i call this class? I thought that by creating the class in functions.php....               $p= new Plans();      .... I was going to be able to access $p everywhere but it seems that im wrong. What would be the best approach ? On my case for example i need in header.php               $p->get_fplans_count();      On page-plans.php               $p->get_purchased_plans();      And so on.... **EDIT:** I dont want php help, i just want to know how to use a php class properly in WordPress. It seems that its a bit confusing for me to explain it (English is not my native language) Really Thanks for all your help


Front-end Register Form

I'm looking for an easy way to place the user registration form on the front- end of a WordPress site. I've already used wp_login_form() to place the login form on the front end, but now I need to do the same with the signup form. Any ideas?


Obfuscating Email Addresses in Form Fields

I'm writing a WP Theme where registered users can email post authors sending them en email from the post's page itself. So I created a contact form in which I get the user and author infos and emails and I put them in hidden input fields to pass them to the php mail function. Does WordPress have a way to obfuscate the post author's email address, to protect it from scrapers? Is there a better way to implement this functionality, other than outputting the author email address in the form field? Thanks!


How to add a Rewrite Rule / Category Structure

I'm currently trying to use `add_rewrite_rule()` to create a rewrite (duh!), for a custom taxonomy page. I've added the rewrite tag "sort" with the following code:               add_rewrite_tag('%sort%','([^&]+)');      The issue is I'm not very familiar with the rewrite structure and I'm struggling.. I have a rewrite rule that is getting close, but still not quite working.               add_rewrite_rule('^vehicle-make/([^/]*)/?','index.php?page_id=40&sort=$matches[1]','top');      The problem is it's pulling in the wrong page; I'm needing to show the taxonomy archive for the specific term. So instead of a page ID I'm guessing I just need to pull in the taxonomy name and current term archive.


Sorting multiple custom post types without a meta key/value pair by sort order

At this current moment. is it possible to sort multiple custom post/page types without a meta key/value? I'm looking to just sort the posts by page attribute order: ![enter image description here](http://i.stack.imgur.com/D6gb0.jpg) **What have i done so far? I've created a query like so and no luck**                 <?php       // query for videos in the home page category       $args = array(        'post_type' =>array('videos', 'podcasts'),         'category_name' => 'Videos on Homepage',         'post_per_page' => 4,        'order' => 'DESC'        );       $loop = new WP_Query($args);       // etc....            ?>


Get List of Registered Meta Boxes and Removing Them

Is there a function for getting a list of registered Meta Boxes and removing them? I see there is a method for adding, and removing. http://codex.wordpress.org/Function_Reference/remove_meta_box http://codex.wordpress.org/Function_Reference/add_meta_box


Not able to call class in NHP framework

I have downloaded fresh framework and installed on my local server. I copied options folder and `nhp-options.php` inside my theme directory. Then I called the class globally by               global $NHP_Options;      When I try to call copyright information in the footer               get("copyright_footer");      I get the following error > Fatal error: Call to a member function get() on a non-object in > C:\xampp\htdocs\word\wp-content\themes\mCube\footer.php on line 19 Why is that, and how can I make it work?


Append jquery script for each [partners] shortcode with specified values

I'm trying to do a shortcode which will add additional jQuery script to `wp_footer`. So this gonna be an example shortcode:               function partners($atts ) {         global $extra_options, $pslider;         extract(shortcode_atts(array(                   'ids' => null,                 'extra_options' => null             ), $atts));                $pslider = 'partners-slider'.rand(100,999);         $ids = explode( ',', $ids );         $output = '

';         foreach($ids as $id) {             $img_attr = wp_get_attachment_image_src( $id, 'full' );         $alt_text = get_post_meta( $id, '_wp_attachment_image_alt', true);         $output .= '

';             }         $output .= '

';         return $output;       }            add_shortcode('partners', 'partners');      From the above function I need to get variables and place them in a jQuery script:               function print_partners_scripts() {         global $extra_options, $pslider;         echo '' . "\n";     }          add_action( 'wp_footer', 'print_partners_scripts' );      Ok, at the moment I have a shortcode which can return working slider. But, what if I try to use this shortcode again on the same page? I've checked, the jQuery script will append only once. I would like to generate this jQuery script for every [partners] shortcode. For example:               [partners extra_options="something: true"]     [partners extra_options="something: false"]      First one should add this script to `wp_footer`:                     It worked.   The second one should add the same script with different variables:                     Unfortunately this one was not added. Really need your help!


Conditional menu display

I have the line of code below with the intention to display the called menu in every other page except the home page but it still shows up on the home page. Any ideas what the problem could be.                   <?php if (!is_home()) {         wp_nav_menu (array('menu'=>'sideBar','menu_class' => 'navbar'));      } ?>


Ajax Slideshow in Post

Is there a way to make an ajax slideshow like this? Each slide contains an image and description and is loaded via **ajax** call. I suppose an easy way for an author to make up such slideshow post is to use the following shortcode markup:               [slideshow]         [slide1]
desc 1
         [/slide1]         [slide2]
desc 2
         [/slide2]         [slide3]
desc 3
         [/slide3]     [/slideshow]      There is also one more idea that would make life of authors even easier:
desc 1

desc 2

desc 3
      How can I achive anything like this?


after_setup_theme is called three times

Trying to find an issue with my theme that is not related with this question, I've started the debugger and enabled a breakpoint to the first line of a function hooked to `after_setup_theme`. Here I've realized that the function is called three times, before the page is rendered. Is that normal? Isn't this action supposed to be called only one time? Here's an excerpt of the functions.php (`after_setup_theme` is the only hook in functions.php):               function get_theme_text_domain()     {         $theme = wp_get_theme();         return $theme->get('TextDomain');     }          //This is the function that is called 3 times when opening any page of the site     function tamtando_theme_setup()     {         load_textdomain(get_theme_text_domain(), get_template_directory() . '/languages');         //[...]     }          add_action('after_setup_theme', 'tamtando_theme_setup');      To clarify, checking the value of $wp_filter['after_setup_theme'], I've found 2 hooks: one is from my theme, the other, from the "Event Organiser" plugin, calling a different function (I wonder why the developer is using this hook, but this doesn't relate to this issue).


Custom database table question

So I have a question regarding creating a new database table for my plugin, the Easing Slider, which is getting a major overhaul. Up until now, I've relied on `update_option`, `get_option`, and those various functions to save, edit and get plugin settings. It has worked well, but I've hit a slight snag. So the plugins bigger, "premium" brother allows you to have more than one slideshow. This is done through saving a multi-dimensional array in a single option. I then have a function that select a specific array by the ID specified, which acts as the focal point for getting a specific slideshows settings. The problem is, this plugin allows unlimited slideshows, each with unlimited images. Many users have been creating hundreds of slideshows, and the odd few are having problems at this point. As you can imagine, (for example) a 100 slideshows, each with 20 images, and each image with about 20 different settings, the one database option can get very large. As a result, for unknowns reasons, the odd user experiences issues and suddenly cannot create new slideshows or images, even though `'update_option'` is reporting back true, letting us know that it has succeeded. One can only assume this is because the database option has hit its limit (possibly wrong, I've no idea why). So I am looking into changing the way things work and using a custom database table. However, the one thing I can't get my head around is actually creating the table dynamically. The nature of the plugin is such that new features are added often, as well as removed. Filter hooks also allow users to add their own new features/settings easily. Each setting would ideally have its own column. As a basic example, I could easily compile the ID's of the various settings into a single array. But could the database table be created from an array as simple as this?               $array = array( 'option_one', 'option_two', 'option_three' );


Ability to edit image via WYSIWYG

In the wordpress post WYSIWYG, you can easily add images from the media library. But, once the image is inserted into the post, it is not intuitive to edit the image's source to a different image in your media library. You have to remove the image completely, and then add another one in it's place. So what I am asking is twofold:   1. Can the tinyMCE editor plugins (in this case wpeditimage) be overridden via functions.php or a plugin? Or can I totally override it with my own?   2. Do you agree with me that this is a usability issue in WP, or am I just smoking something? Any feedback or suggestions highly appreciated


Custom seperate Single.php

In my site I have a blog where each posts loads single.php like normal wordpress installation. I also have a "shop" custom page where each links also loads single.php but the permalink is different. For normal blog post the permalink goes like this:               http://www.mysite.net/2012/07/02/blah-blah-blah/      For custom shop page the permalink goes like this:               http://www.mysite.net/shoppage/blah-blah-blah/      What I am trying to do is not load default single.php when clicking on individual post from shoppage template. I want to load a custom single.php with my own changes added. Is it possible? Relevant part for index.php:
                                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                                 <?php echo __('Posted on ', 'wizy') . get_the_date(); ?> <?php _e('in ', 'wizy'); echo the_category(', ');?> by <?php the_author(); ?>
                                             relevant part from shoptemplate.php:

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                      <a href="<?php echo $thumb_src[0]; ?>" class="project_thumb zoom">                                 <?php if( has_post_thumbnail() ) : ?>                                     <?php the_post_thumbnail('project_thumb_midd'); ?>                                 <?php else : ?>                                     <img src="<?php echo TIMTHUMB; ?>?src=<?php wizy_assets_uri(); ?>/images/image_placeholder.png&w=300&h=250&zc=1" alt="<?php the_title(); ?>">                                 <?php endif; ?>
                                     <?php the_content('',FALSE,''); ?>
                                                                       <?php if( $pos = strpos( $post->post_content, '') ) : ?>                                     <a href="<?php the_permalink(); ?>" class="more_link"><?php _e( 'View Project →', 'wizy' ); ?>                                 <?php endif; ?>
      I know my way around with wordpress, but not so much with php


query_posts: how to show all 'meta_value' containing a specific word?

How could you display all the post in a loop with a (custom) meta_value containing a word/phrase? for exemple get al the post where meta contains 'test'.               query_posts('post_type=SOME&category_name_2=SOME&meta_value= 'Cotains the word 'test' ??? ');       so when the meta tags are 'test movie' or just 'test' you get them both.?


Use custom posts as taxonomy term meta replacement?

Taxonomies are very useful for all sorts of things. But as many have pointed out they suffer from their lack of ability to carry metadata. Assuming I have only posts that don't have 'natural' parents on my site, why shouldn't I just taxonomise my posts by attaching them to a post_parent, and store my metadata in the parent's post_meta? **FOR EXAMPLE** I have a CPT 'birds' and a taxonomy 'user_bird_collection'. I have a user, Jack, and I want to add the Canary to his collection. **With a taxonomy** I create (or append to) a term in the user_bird_collection called 'Jack' (or something more unique like his UID), adding the Canary to the term. When Jack goes to mybirds.com/my_collection I show him all the birds in his term. If he wants to go one better and name his canary, I'm in a pickle because I have to add metadata to the _relationship_ between the canary and Jack's collection. **With post_parents** I create a new post with Jack as the author, whose post_parent is the ID of the canary. When Jack goes to the collection page I show him all the posts that belong to him, and I cleverly divert all the demands for bird details, images etc up to the original canary. When he wants to name his canary, all I need to do is add metadata to Jack's post - effectively his 'own' copy of the canary, a sort of wrapper around it. **OBVIOUS ADVANTAGES**   * Querying is just as easy.   * I can add as much metadata as I like to the original bird OR the personalised bird using post_meta.   * I'm not tied to one of several competing implementations of term meta.  What's the problem with doing it this way?


why the posts queried from sql is more than those showed on the page?

i am using WordPress multisite, the issue i face is that the posts queried from sql is more than those showed on the page, the details is as follows:               mysql> select count(*) from wp_137_posts where post_type='post';     +----------+     | count(*) |     +----------+     | 32 |     +----------+     1 row in set (0.46 sec)      here i find there is 32 posts to the blog whose id is 137 but in fact when i open that blog, i can find only 30 posts including both published and draft posts. why there are not 32 posts when i open my blog?


Lightword Theme - only one menu item

Since I am pretty new to WP and the whole stuff i ran into a problem. I am using the pretty-well known "Lightword" Theme. And today i've upgraded to the newest version. It's now possible to add/edit the menu items through the theme-settings. Although I like this very much I am not able to display more than one additional menu-item. When I go to "wp-admin/nav-menus.php" I am able to select a menu item in a box (the english titel of the box is probably: "Position in theme") on the left- side. But I am only able to select one. So what can I do to show up all created menus? Thanks for your help


How to implement friend system for Wordpress?

At the moment my users posts are only viewable to them. I would like to implement a system where they can choose to share any post with other users they know. The problem I'm having is, how do I make the connection between users? The best I came up with is to create a table in the db and store their friends by user id's. Example:               user_ID 2   friends_ID 5,9,34,85          user_ID 87   friends_ID 67,2,99,100,58,309      I want to be able to retrieve their friends list so I can use it later in various parts of the site. I know this will not be simple, but I am fully open to ideas, suggestions or similar plugin. Thank you all in advance.


Using theme options to change a border-radius value

I'm developing a theme where I'm using theme options to allow users to set various things -- text size, background colour, link colour, etc. The basic code I'm using for the options is in header.php and looks like this:               <?php      $options = get_option('mytheme_theme_options');          if( isset( $options['backgroundcolour'] ) && ( !empty( $options['backgroundcolour'] ) ) )        printf( "body {background: #%s;}", $options['backgroundcolour'] );          if( isset( $options['linkcolour'] ) && ( !empty( $options['linkcolour'] ) ) )        printf( "a, a:link {color: #%s;}", $options['linkcolour'] );          ?>      One of the options I want to set is a border radius for some chunks of content, which requires multiple declarations of the same value to work in all modern browsers:               .post {-webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius: 8px;}      So, how do I get the PHP above to declare the same value three times in my CSS? I should add that I'm not normally a PHP person; feeling a bit out of my depth here. :) Thanks.


Bulk Image Uploader to create new post from each image

Is there any plugin which creates a new post from each image I upload/select with it? I want to create many posts with one image per post. Currently I select, upload all images. Then create new post, name it same as image file name, insert image from media library and then save to draft/publish it


How to view all posts (on site, not admin) that are uncategorized?

I had a horrible problem a long time ago that had me end up importing a backup of most of my posts. I'm now using WordPress 3.3.2 and I would like to view all of the uncategorized posts from the site view, not in the admin. I have attempted to use http://www.southfresh.org/uncategorized http://www.southfresh.org/category/uncategorized Both with capitalized and not. But those come up as bad pages. Is there any way to view just these posts?


Blogroll entry generates hundreds of 'Links to Your Site' in Google Webmaster Tools for the linked site

I recently noticed that Google Webmaster Tools counts the blogroll link on every page of a Wordpress blog as a separate entry in 'Links to Your Site'. If the Wordpress site has 100 posts that all show the blogroll (which is typical), that will generate 100 separate entries in 'Links To Your Site' in Google Webmaster Tools for each site linked from the blogroll. Given recent news that Google is starting to penalize sites with 'unnatural' incoming links, I'd like to figure out how to prevent a Wordpress blogroll from doing that. Frankly, I think GWT should be smart enough to figure this out, but I don't have much hope that Google will rationalize this. It's also not clear that this kind of thing will actually be penalized, or whether Google is able to make the distinction. But who wants to take the chance? Aside from configuring the sidebar with the blogroll to appear only on the home page, is there any way around this? Would 'nofollow' help? Then again, I've heard that use of 'nofollow' may also be penalized. Geez, Google. Here's a link to one of the recent stories making the rounds: http://www.seroundtable.com/google-link-spam-notifications-13652.html


ajax call in wordpress front end

In my plugin i'm using two ajax calls in back end. that worked well. but to provide the same functionality in front end i loaded the copy of these two functions with another names and my code is: in my plugin main file:               function my_action_callback(){       global $wpdb;      if (@$_POST['id']) {              $daty = $wpdb->get_results("select eemail_id,eemail_content,eemail_subject  from " . WP_eemail_TABLE . " where 1=1 and eemail_status='YES' and eemail_id=" . $_POST['id']);         //echo "select eemail_id,eemail_content,eemail_subject  from ".WP_eemail_TABLE." where 1=1 and eemail_status='YES' and eemail_id=".$_POST['id'];              if (!empty($daty)) {             foreach ($dat as $datt) {                 echo $datt->eemail_content . "_" . $datt->eemail_subject;                 die();             }           }          }         }       add_action('wp_ajax_nopriv_my_action', 'my_action_callback');      and in my settings.js               function showEntryfront(id)        {               jQuery(document).ready(function($) {              var data = {             action: 'my_action',             id: id              };               jQuery.post(ajaxurl, data, function(response) {             //alert('Got this from the server: ' + response);             var n=response.split("_");               jQuery('textarea#mail_contents').text(n[0]);             $('#mail_subject').val(n[1]);             // jQuery('textbox#mail_subject').text(n[1]);               });            });        }      and the plugin page which fires this showEntryfront() is:               <select name="eemail_subject_drop" id="eemail_subject_drop" onchange="showEntryfront(this.value)">                     <option value="">Select Email subject</option>                     <?php echo $eemail_subject_drop_val; ?>                 </select>                 <input type="hidden" name="send" value="" id="send" />
                  <textarea   name="mail_contents" id="mail_contents" rows="4" cols="40" ></textarea>
      The second function is doing the same. only the db table is different. Still my firebug console shows               ReferenceError: ajaxurl is not defined     jQuery.post(ajaxurl, data, function(response) {      and the textarea is not filling up with the db data from the table WP_eemail_Table. Please not that this functionality worked in wp-admin backend. i know the ajax call in admin will automatically load by admin- ajax.php. but how can i implement the same in front end. any mistake in my code??


Get all image IDs from the Media Library

I'm fairly new to PHP and I believe this is a fairly basic question. I've spent hours searching for an answer but can't quite seem to get things right. So any help would be appreciated. I'm trying to create a gallery page on my site that automatically includes any newly uploaded images in it. My ultimate plan is using Justified Image Grid as my gallery manager. This requires putting the image ID in the JIG shortcode. In my template page I want to 1st - get all images IDs from the media library. 2nd - call the JIG shortcode and insert the IDs as the gallery images. From there I will set up filtering inside JIG. From my understanding I can't get the image IDs directly from wordpress. I have to first get their URLs and then extract their IDs. If there is a more efficient way to do this please let me know. So far I have this code to get all the image URLs (from this discussion: Get All Images in Media Gallery?):               $query_images_args = array(         'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1,     );          $query_images = new WP_Query( $query_images_args );     $images = array();     foreach ( $query_images->posts as $image) {         $images[]= wp_get_attachment_url( $image->ID );     }      This works fine when I print the array. Next I have this code to return the image ID from URL (From https://philipnewcomer.net/2012/11/get-the-attachment-id-from-an-image-url-in- wordpress/):               function pn_get_attachment_id_from_url( $attachment_url = '' ) {          global $wpdb;     $attachment_id = false;          // If there is no url, return.     if ( '' == $attachment_url )         return;          // Get the upload directory paths     $upload_dir_paths = wp_upload_dir();          // Make sure the upload path base directory exists in the attachment URL, to verify that we're working with a media library image     if ( false !== strpos( $attachment_url, $upload_dir_paths['baseurl'] ) ) {              // If this is the URL of an auto-generated thumbnail, get the URL of the original image         $attachment_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachment_url );              // Remove the upload path base directory from the attachment URL         $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );              // Finally, run a custom database query to get the attachment ID from the modified attachment URL         $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) );          }          return $attachment_id;     }      This works fine for one URL. What I can't figure out is how to loop through all the URLs returned by the $images array and return all the IDs. Can someone help or show me another way to tackle this problem?


Enqueue script in Widget

I am trying to use wp_enqueue_script inside function widget of the Widget class. But it seems like when I print html it doesn't handle the javascript functions which I enqueue before. This enqueue script works well if I use for shortcode inside shortcode and later print html. Is there any workaround for using enqueue inside widget function that will properly handle my html also?


comments_template not working correcly in custom template files

In a template file that I am using as page, I want to allow only 2 users to post comments and allow to all other users to only see these comments( not allow them add comments). my template file is:               <?php get_header();  ?>          <?php      if (get_current_user_id()==1 or get_current_user_id()==2 ) {          comments_template( '', true );                         }     else     {     comments_template( '/comments-with-no-form.php', true );          } ?>          <?php get_footer(); ?>      Normally, when I remove `comments_template` from single.php, or just remove the `<?php comment_form(); ?>` from comments.php, changes apply. But in separate template file, nothing is working. The file `comments-with-no- form.php` is never executed (only style of comments.php changes). Your help is appreciated.


70.000 custom posts on my site

My site have more than 70.000 custom posts. Admin panel not show all posts. how to fix it ? ![More than 70k post](http://s29.postimg.org/id0bpu3pz/Untitled.png) Month filter: more than 4.000 posts. it's normal. ![4.000 post](http://s30.postimg.org/hpn7z48ht/Untitled.png)


How to enqueue stylesheet after rtl.css?

When you use rtl language by default wordpress enqueue rtl.css file at the end of all stylesheets. what I need is how to enqueue a stylesheet after rtl.css stylesheet so the result should be like the following?               <link rel="stylesheet" href="http://example.com/wp-content/themes/mytheme/rtl.css" type="text/css" media="screen" />     <link rel="stylesheet" href="http://example.com/wp-content/themes/mytheme/responsive-rtl.css" type="text/css" media="screen" />      Thanks


is_search not working on search results page

Having an extra submenu with this code in sidebar:               <?php if(is_404() || is_search()) : ?>     <?php echo 'zou leeg moeten zijn'; ?>     <?php else : ?>     <?php       if($post->post_parent == '68')       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");       else       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");       if ($children) { ?>       <ul>       <?php echo $children; ?>       </ul>       <?php } ?>     <?php endif; ?>      I have a problem with the first line: Working fine on 404 page and on searchpage if you search for something that doesn't exist but when you look for something that does exist the sub menu is popping up in the sidebar. What is wrong with this code? Ariane


Have lots of meta for posts, is it better to get at all at once or each individually

I have a directory website and am doing a bit of a redesign/restructure. I have quite a few meta fields for each entry, i.e. address, city, country, website, where to buy their products, social links, background and so on. I don't display all the meta data in the same place in my layout. So my question: Is it more efficient to use `get_post_meta($id,$key,false)` and have all my meta values stored in a `$variable`, or is it better to get each individually? I would assume it is the former, but wanted to get some feedback.


Users cannot post when editor or admin on more than 1 site on multisite

Just upgraded to 3.6.1 last week. I have rolled back and re-upgraded 2 times. When I roll back everything works. I've Turned off plugins, changed to 2012 theme. Tried 3.7 with same issues. Users can create posts in post-new page no problem UNLESS they are editor, admin etc on another blog in the multisite. If I remove a user from a second site they can immediately post in the first and vice versa. They can use quick press from the dashboard to add a post and are able to edit without issue. The post object is not created or fails to create when the user is on two blogs.               Notice: Trying to get property of non-object in D:\Websites\wp-admin\includes\post.php on line 471 stdClass Object ( [post_content] => [post_title] => [post_excerpt] => [post_name] => )      Notice: Undefined property: stdClass::$ID in D:\Websites\wp-admin\post-new.php on line 73     Notice: Undefined property: stdClass::$post_date in D:\Websites\wp-admin\edit-form-advanced.php on line 52      Notice: Undefined property: stdClass::$post_date in D:\Websites\wp-admin\edit-form-advanced.php on line 65      Notice: Undefined property: stdClass::$post_status in D:\Websites\wp-admin\edit-form-advanced.php on line 90      Notice: Undefined property: stdClass::$post_status in D:\Websites\wp-admin\edit-form-advanced.php on line 124 Notice: Undefined property: stdClass::$post_type in D:\Websites\wp-includes\taxonomy.php on line 169      Notice: Undefined property: stdClass::$post_type in D:\Websites\wp-includes\taxonomy.php      Any suggestions or ideas are greatly appreciated.


Multsite blogs' menu shows Main site menu

I have a site (WIP) that was working perfectly fine until I updated to 3.7 a few days ago. Since the update, I can visit the sub-sites (blogs) homepage's fine, but the menu that appears (on all blogs) is the main site menu. I have checked the wp-config.php and .htaccess file and cannot see what could be wrong? Any help would be appreciated. Thanks in advance. Linky: http://hartwoodgroup.co.uk/


Ordering posts by metadata

In my plugin, I use these instructions to obtain a list of posts:               $args = array(         'numberposts'     => -1,         'offset'          => 0,         'meta_query' => array(             array(                 'key' => 'metadata1',                 'value' => '80',                 'compare' => '<=',                 'type' => 'UNSIGNED'             ),             array(                 'key' => 'metadata2',                 'value' => '4.6',                 'compare' => '<=',                 'type' => 'DECIMAL'             ),         ),         'post_type'       => 'post',         'post_status'     => 'publish',         'suppress_filters' => true );          $posts = get_posts($args);          foreach ($posts as $post) {         // some work on $post     }      How can I order these posts by `metadata1` ascending or by `metadata2` ascending? (Note that `metadata1` is an unsigned integer number, and `metadata2` is a decimal number.)


wordpress imported images not working for featured image

To import images into my wordpress site, I added the actual image into the correct month's folder in the uploads directory and I created a post as type attachment with that image name and url. When I go to a post and press Set Featured Image, I see all the images I imported there. If I select one of them, it doesn't work - just closes the media library and acts as if nothing happened. When I select a different image it does work, so it's something wrong with the images that I imported and not with the uploader. Any ideas what could be wrong?


Completely disable categories

Is anyone aware of a plugin that disables categories in WP? By this, I mean completely hiding the feature from view automatically, for existing and new users alike. In particular:   * the WP admin menu   * the posts list, its screen options, and its filters   * the post editor and its screen options   * the widgets screen   * the writing and permalink settings screens I've run into a variety of aging hacks to do part of this, namely and mostly code to disable meta boxes and a handful of plugin to disable the permalink prefix. I'm turning to SO in the hopes that some web designer or developer might have the entire set of features on hand. If not, might there be new APIs from the past 3-4 years that make the process simpler (my WP skills are getting rusty), or is seeing it through going to be an awkward output buffer manipulation-related hack?