0

I use this plugin : http://wordpress.org/support/plugin/more-fields/page/2

How use WP_QUERY for this inputs ?!

1
  • 1
    What exactly are you trying to accomplish? What have you done already? Dec 6, 2013 at 8:02

1 Answer 1

0

More fields Plugin is to enter additional input into the post, page etc. And that is Custom Fields in WordPress.

To use WP_Query() for those Custom Fields input, you have to query for the meta_key.

<?php
//Query for only my custom field value
$args = array(
          'meta_key' => 'your_field_key'
        );

$wpse_query = new WP_Query($args);

while( $wpse_query->have_posts() ):
$wpse_query->the_post();

   if( get_post_meta( $post->ID, 'your_field_key', true ) != '' ):
      echo get_post_meta( $post->ID, 'your_field_key', true );

endwhile;
?>

Learn more from Codex: WP_Query() - Custom Field Parameters.

More related answers can be found HERE.

Additionally, More Fields plugin is not actively maintained, so it's not fit for updated WordPress. Better use other plugins like: Advanced Custom Fields, or the like.

2
  • Thx, How use check variable is exists ? after this code : 'meta_key' => 'your_field_key' check your_field_key == 'ok' ?
    – Mohammad
    Dec 6, 2013 at 11:04
  • Updated the answer with an if() before the echo. If the answer satisfy your need, don't forget to upvote it and mark the answer as accepted. We guys work here for reputation. :) Dec 6, 2013 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.