Filter by custom field (meta_key) using JSON API

As this is too much for a comment, I’ll post here and delete later: http://example.org // domain ?json=get_recent_posts // controller # Arguments for the query start here &post_type=mytype &custom_fields=myfield &include=title,custom_fields &meta_key=myfield &meta_value=myvalue Have you tried the following? Debug the response: http://www.example.org/api/get_page_index/?dev=1 Widget-style JSONP output: http://www.example.org/api/get_recent_posts/?callback=show_posts_widget&read_more=More&count=3 Redirect on error: http://www.example.org/api/posts/create_post/?callback_error=http%3A%2F%2Fwww.example.org%2Fhelp.html And could you post what you … Read more

Query multiple meta values

You code is generating a broken meta_query. You code will produce something like this: array(1) { [“meta_query”]=> array(2) { [0]=> array(2) { [“relation”]=> string(2) “OR” [0]=> array(3) { [“key”]=> string(4) “test” [“value”]=> string(10) “test_value” [“compare”]=> string(4) “LIKE” } } } It should look like this: array(1) { [“meta_query”]=> array(2) { [“relation”]=> string(2) “OR” [0]=> array(3) … Read more

How to create a Custom Meta Box with Name/Value Admin User Input Fields?

To help you understanding how forms work: They add to the $_POST array by a form fields name argument. <input type=”text” name=”foo” value=”Fooo!” /> would produce $_POST (array) => foo => Fooo! while <input type=”text” name=”foo[bar]” value=”Bar.” /> <input type=”text” name=”foo[baz]” value=”Baz.” /> would produce $_POST (array) => foo => (array) => bar => Bar. … Read more

Add meta value to custom post type on publish

You are usgin an undefined $post->ID variable because there is no reference to any $post object in your code; instead, use the $post_ID variable retrieved in the function: function on_jobs_publish( $post_ID ) { global $wpdb; $wpdb->insert( ‘iCrewzWp_postmeta’, array( ‘post_id’ => $post_ID, ‘meta_key’ => ‘_yoast_wpseo_sitemap-include’, ‘meta_value’ => ‘always’ ), array( ‘%d’, ‘%s’, ‘%s’ ) ); } … Read more

Get an array of meta_values for a user meta_key

You just need to add a DISTINCT to your SQL query, something like: $cities = $wpdb->get_col(“SELECT DISTINCT(meta_value) FROM $wpdb->usermeta WHERE meta_key = ‘my_cities_meta_key'” ); Alternatively, if you want to do it with php for some reason (if you want to know that a city is listed twice before displaying only unique entries) $cities = $wpdb->get_col(“SELECT … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)