Is it possible to retrieve all posts with a certain value for metadata?
Under 4.5, I have posts with meta_key as series and meta_value as 19, 20, etc I am trying to loop through them in a template, and I guess I’m a special kind of dense. Most recently I have tried $args =...
View ArticleWhere does the actual data stored by add_post_meta
I am pretty new to WordPress API, loving it btw, I have a small project, adding a like button to the end of every post, pressing it makes user like the post, button changes to dislike, pressing again...
View ArticleGet the correct meta_value with get_post_meta
I tried using the function get_post_meta() to get the meta values of my posts. However to my surprise it returns an Array that contains again arrays! So I looked inside the second level array, and was...
View Articleis_main_query() never called on WP 4.4
Im fairly new to WP dev, however as far as i can see ive followed the correct procedure in my custom archive page (below). If i remove the check for is_main_query() it wipes the menus out and likely a...
View ArticleBest Way to detect unique posts in wp rest api
I am developing an android app for my WordPress blog. I have some bad trouble to detect and get post. So first I give u a vision from what I am into: I want to get post from past, so I do this: Get the...
View Articleshow ad after # paragraphs
Trying to use ACF to determine when to insert an ad after # many paragraphs. Right now after 3 paragraphs the ad is inserted. if ( is_single() && ! is_admin() ) { $show_after =...
View ArticleWP-API + JS Backbone client – how to update post meta
Using the WP API and Backbone-based JS client, I’m trying to update a post’s metadata as follows: var parentId = 96; // the post id var metaData = new wp.api.collections.PostMeta('', {parent:...
View ArticleNested array issue in meta_query
I am using following meta_query to search blog post according to following search criteria, search logic : if expire date set, check the expiry of the post, otherwise just include it if...
View ArticleHow to remove Date from Meta Description on SERP?
I noticed on a few recent projects the Date is displaying in the Meta Description for all Custom Post Types and Taxonomies in WordPress. I was always under the impression the Date would usually show...
View ArticleWPDB Multiple site's posts and get featured images
I am using the code below to query 5 WordPress sites for their posts, merging them into an array, sorting the array by date, and then displaying them: //SITE 1 $mydb = new...
View ArticleDelete custom meta
My custom meta box correctly saves my file upload. When the user wants to clear the field, they can click delete and I want to delete that meta data of the file url only. How can I assign the meta_id...
View ArticleQuery posts according to specific post meta values
I have a loop in my index.php for my home page like this… <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> I have a function to query the posts by ascending...
View ArticleSet all values of given meta_key in postmeta?
I have a custom post type to which I attached several fields of meta data. On a given action in the admin, I need to be able to reset the values of a specific meta_key in that meta data to zero for ALL...
View ArticleUsing esc_html for textarea inputs
I am using the following code for a variety of input fields, building a CPT for a theme: function display_meta_box_from_cpt <input type="text" size="80" name="imgurl"...
View Articlehide posts with specific meta data from admin page
Does anyone have ideas on how to hide posts which has a metadata with a specific value from admin panel (the posts table which is shown when clicking all posts option from posts tab) thank you in...
View ArticleDelete custom post type metadata without deleting the post in admin area
I’m working on a plugin for a client and they need the ability to attach a couple of PDFs to a post as metadata. The client will need to occasionally update these attachments but without deleting the...
View ArticleAdd a meta to a post submited from a frontend form
I use a frontend form by @TheDeadMedic to post regular posts. I figured out how to add to this form a category and a location (custom taxonomy) dropdown menus, and also how to sanitize and how to...
View ArticleEdit is changing my custom's post type parent id
I’m having a custom post type (vehicle) and i attached a gallery (post) with image attachments in it. Through my custom frontend form, I set all the post and postmeta details right, as i want to, so my...
View ArticleDefault Custom Field Value Automatically Update
I have created a hidden custom field with a php function as its value. Like so – $value_rating = get_post_meta($Property_Id, 'vr', true); <input type="hidden" name="vr" class="form-control hideit"...
View ArticleHow to get posts with a metadata numeric key greater than X?
I’m trying to add a “Highlighted” section for each category on my website. This will be located in a page, using a shortcode. I’m going to add a new post metadata key which will be a number from 0 to...
View Article