Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Post meta is a data set containing additional core as well as custom post information.

0
votes
1answer
26 views

Display post number by category

I try to add auto increment post numbering by category. Like cat="myID" > post 1, post 2, post 3... Display post number not post ID number In find this solution, and use post_meta looks a good way. ...
0
votes
0answers
9 views

How to delete meta-field which is registered with register_meta to Rest API

I'm working on a Wordpress integration and updating our WP JSON api v1 to v2. We have custom post types which use two custom meta-fields. One of them should be preserved to the WP's database while ...
-1
votes
2answers
40 views

How to display the date under the post title?

He everyone i'm a newbie to wordpress/php and have 1 other problem. I am trying to get the date under the post title and not to display the category tags above the title. I tried it to change thing is ...
1
vote
1answer
20 views

Multiple postmeta with same name for one post in wp_postmeta table

I have a hidden post meta called _payment for my posts. When i was looking into the tables of the wordpress, I noticed that there are tens of this post meta with the same name for the same post! Here ...
-1
votes
0answers
28 views

Calling get,add,update, or delete _post_meta functions break's the PHP script with error code 500 [duplicate]

I am attempting to make a plugin that when $_POST data is received, it will decode the JSON table from $_POST and use that to update the post_meta for the given post. Data from the JSON table comes in ...
0
votes
0answers
51 views

Action in Ajax request does not run for some user roles

I have an ajax POST request that looks like this: var data = { action: 'like_prof', id: profID, }; $.ajax({ method: "POST", url: ...
1
vote
1answer
23 views

Checking if a post with certain meta value exists

How do I check whether a post with a certain meta value exists? For instance, check if a post exists with _sku = 1?
2
votes
1answer
90 views

Custom Queries: Joining On Meta Values From Two Custom Post Types

Hi – I'm hoping this is the right place to be asking this question. I am in the process of moving my full football club website onto Wordpress, therefore using a single database for the information ...
1
vote
1answer
31 views

Delete all post meta except featured image Using SQL

Please I just migrated my site and I found out that wp_postmeta consumes most of my cpu resources, Is the any Sql code to Delete all post meta except the featured image. I dont want to Use wp ...
1
vote
1answer
16 views

how to make members list directory through wordpress post custom meta key.

I have created a website in which I am providing complete information about the organization. For this, I am using a Wordpress post. In which I am putting information of only one organization in a ...
1
vote
1answer
47 views

Hey, I want the second options. get_post_meta()

I can loop through foreach, but I don't know the second, "My car", "My boat" etc. I want my question is this: car - My car, boat - My boat, bike - My bike $engine = get_post_meta(get_the_ID(), "...
0
votes
0answers
19 views

how to check meta value as a multi array in wordpress query?

I have property listing on my page. i have to do filter on my page if user enter property guest value 5 then i need to fetch only that post where guest value is 5 that store in post meta value as a ...
0
votes
0answers
17 views

Want to send ajax request in wordpress to a custom file in plugin

Want to call a function in my plugin to delete the post-meta on click of a button. How can get this functionality. I suppose it can be done with ajax but i am unable to send ajax request to my custom ...
1
vote
1answer
19 views

How to receive all the meta information of a post ?

How can I get all the meta information of a particular post_id, if my meta_key = 'title' and meta_value = 'My Content Template' meta_key = 'download_url' and meta_value = 'http://www.example.com/pdf/...
1
vote
0answers
15 views

Query Posts depends on custom field inside repeater field using acf

i am working on a hotel website and trying to make price search i have custom post type name hotels inside post type i have a repeater field inside repeater i have some rooms with prices i am ...
1
vote
1answer
30 views

Force the “Choose from the most used tags” meta box section to always be expanded

I'm looking to have the "most used tags" link within the tag meta box on the post page always be expanded. Couldn't find any helpful plugins to use. I did find this previous post but the function ...
0
votes
1answer
30 views

update_post_meta doesn't work

I've been drilling with codes for so long. I was trying to create a metabox with a simple textare on it. Been stuck for almost 10 hours tyring to solve this. Still up until right now my meta box ...
0
votes
0answers
17 views

Remove item from post_meta array via AJAX

I have a form on a page where users can add new text inputs (up to 30 inputs). The entered value of this text input is stored in the post_meta table via AJAX as an array. Here is the php that ...
0
votes
1answer
29 views

ajax delete value from custom field array

I have on my page a multi file upload that saves post attachments within a custom field --- if (!empty($_FILES['vidPix']['tmp_name'][0])) { $i = 1; $files = $...
0
votes
0answers
15 views

How to get the Custom Taxonomy link for specific post in a SQL query

I'm using the 'wpDataTables' plugin and there's a lot of working with SQL which I haven't done before. I'm sorting custom taxonomy data from posts into a table and need each bit of data to link to ...
0
votes
1answer
57 views

change order of images attached to post

Im not quite sure how to explain my issue so let me know if Im unclear about anything. I have on my front-end post form a multiple file upload input that uploads files to my specified folder and ...
1
vote
2answers
33 views

Display post metadata: “title, category, author, date” with shortcode

How to create shortcodes to the standard post-metadata "title, author, category and date" in order to display it in post-content? E.g. post-content including shorcodes: Lorem ipsum dolor [post_title]...
0
votes
0answers
22 views

Check value of post meta within IF statement

I am creating a function to update the post excerpt using the value of the custom field 'post_preview'. During the loop, a new post_meta is being created and set to true, so I know the conversion has ...
0
votes
1answer
144 views

Update Line Item Meta Data - WooCommerce API

stuck trying to update line item meta fields I've attached to each line item. From a call to a particular order you an see the line item meta attached below: "line_items":[ { "id":...
0
votes
0answers
16 views

Move Entry Meta Above Title in Archives (Genesis + Brunch Pro)

I am using Genesis + Brunch Pro, and am attempting to flip the position of the entry title and entry meta in my archives section, so that the date appears before the title: http://simplysamanthablog....
0
votes
0answers
18 views

How to show custom listing in WordPress admin side using wp_list_table using submenu

I have created custom WordPress plugin. I have stored post Id and user id, user id is based on meta_key in postmeta wordpress table. My stored meta key is custom_users in postmeta table. I have ...
0
votes
1answer
38 views

How can I get values using key in Carbon Fields from Multiselect?

I have Multiselect field, created using latest Carbon Fields (2.2.0) library: Field::make( "multiselect", "available_on", "Available on" ) ->add_options( array( 'windows' => '...
0
votes
0answers
14 views

How to produce functions dynamically

I'm trying to add some meta boxes in new post page but instead of doing copy paste and changing some values; echo '<a href="#">Add New</a>'; I want to add a link and add an onClick ...
0
votes
1answer
4 views

Update Post metafield of specific categories

I have some meta fields in WordPress created by theme and i want to update it by using php. The metafield stores url and i want to add some string after current url in custom meta. i tried these ...
0
votes
1answer
26 views

update_post_meta in loop changing ALL values

I have a button on the frontend that updates the value of post meta on the backend, and it's nested inside a loop. However, on submit it updates the value on ALL posts. What am I doing wrong? ...
0
votes
2answers
50 views

Updating post meta for checkbox

<div class="vp-field vp-checkbox vp-checked-field vp-meta-single" data-vp-type="vp-checkbox" id="_custom_meta[category][]"> <div class="label"> <label>Categories</label> &...
0
votes
1answer
23 views

Add a post metadata if only the key and value does not exist

In a WordPress post, these multiple values exist for a custom metadata with the key "client" client=>Andy client=>Johny client=>April I want to add a new metadata only if its value does not ...
0
votes
0answers
11 views

How can I get a list of posts that a certain user is the author of OR the user id is found in an array of a post meta field?

I have a CPT called Service. Posts that are the CPT service can have a custom meta field called user_access, which contain a user ID. If a user's ID is found in the user_access array of a certain ...
0
votes
1answer
14 views

show user based on user_meta

it's possible to show user if my logic like this it's better to give illustration USER I have two users with usermeta: user A have usermeta country with value "USA" and univ with value "UCLA" user B ...
0
votes
1answer
16 views

Sort by postmeta on when searching

I'm trying to sort by total_sales when searching, I have this till now but does not seem to do anything add_action( 'pre_get_posts', function ( $q ) { if ( !is_admin() // Target only front end ...
0
votes
2answers
20 views

wordpress last all added get meta value by post id

How to get the last added meta value by post id This is what I have tried so far: $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' ...
0
votes
1answer
158 views

Optimize WP Meta Query for large amount of post meta?

I have a large WP site with about 2k posts and 150k postmeta. When browsing to a large category, the archive loads very slow due to the WP query that is seeking for featured posts, to show them first. ...
0
votes
0answers
17 views

how to display event post Query by custom meta, with start_date and_end date

I am working on event listing site and i want to make a featured event page where only all featured event will list. I am using Custom Fields to the event posts. The relevant fields are ...
0
votes
1answer
9 views

Post Meta statement?

I have a Post meta field in my template. I have 3 values for this meta: Yes No N/a How can I set a custom css class according to the value ? My code: <span class="widget_last"><?php echo ...
5
votes
1answer
186 views

How to edit a post meta data in a Gutenberg Block?

I am trying to follow the instruction in the Gutenberg Handbook to create a block that can change meta data of a post. Though when I try to use the setAttributes function from props to save the new ...
0
votes
1answer
51 views

Query postmeta based on meta_value, return array of post_id

I'm trying to retrieve an array of post_id from postmeta where the meta_value matches some value. In MySQL the query would be something like this: SELECT post_id FROM azEw_postmeta WHERE meta_key='...
0
votes
1answer
24 views

Customize rel=canonical tag for single blog post

I wrote a guest blog post for another website. I'd like to publish this same blog post on my website but include a canonical URL that points to the original publisher. This allows me to post the ...
0
votes
0answers
20 views

how to query posts using value in meta post array

I googled this case for more than a week, I didn't get any correct answers I have a post type called listing. This listing have a rating stored in wp_postmeta table, the stored meta_key is ...
0
votes
1answer
42 views

How to get post detail based on URL of the post

I have a custom php page where I need to display details of a WordPress post based on the URL entered from the Admin. In the Admin, when adding the project detail, we enter few URLs of article post ...
0
votes
1answer
19 views

searching by keywords in post's metas or pagination links problem

i wanna create a custom search that will search posts by keyword not only in their titles and/or contents, but in post metas. for example, from $wp_query->query_vars['s'] i got a word 'plastic' after ...
0
votes
1answer
20 views

Print specific values stored in a post meta array

I'm triing to print some values stored in a post meta. My post meta_values looks like this : a:3:{s:6:"amount";s:117:"€2.00";s:6:"entity";s:5:"11854";s:9:"reference";s:9:"800146779";} I'm ...
0
votes
1answer
20 views

Multiple meta key and value search in the query

I am have this following API code for $_REQUEST $metakey = explode(',',$wpdb->escape($_REQUEST['key']) ); $metavalue = explode(',',$wpdb->escape($_REQUEST['value']) ); $meta = ...
3
votes
2answers
94 views

Sanitizing `wp_editor();` Values for Database, Edit, and Display

I'm using custom instances of wp_editor(); to allow rich text editing of Post Meta associated with a Post Object. I'd like to perform much of the same sanitization that occurs with post_content for ...
0
votes
1answer
28 views

Stored meta from attachment, video length?

I am working on a function which pulls the length (in seconds) of the selected video in a custom post type, and puts this in a input. I have come as far as this function: value="<?php if ( isset (...
0
votes
0answers
13 views

Programatically delete several attributes in _product_attributes in post meta

First i tried this one add_action('template_redirect', 'hooker'); function hooker(){ delete_post_meta( 1054, 'Душ, шт.'); delete_post_meta( 1054, 'Ванная, шт.'); delete_post_meta( 1054, '...