Created
July 27, 2014 06:55
-
-
Save generatepress/5e35a595e01380e269f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once( '../../wp-load.php' ); | |
$args = array( | |
'post_type' => 'edd_license', | |
'showposts' => -1, | |
's' => $_POST['email'] | |
); | |
// The Query | |
$the_query = new WP_Query( $args ); | |
// The Loop | |
if ( $the_query->have_posts() ) { | |
$posts = $the_query->get_posts(); | |
$items = array(); | |
foreach ( $posts as $post ) { | |
$item_name = $post->post_title; | |
$items[] = substr( $item_name, 0, strrpos($item_name,' -') ); | |
} | |
echo json_encode($items); | |
} else { | |
// no posts found | |
} | |
/* Restore original Post Data */ | |
wp_reset_postdata(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment