Questions tagged [post-meta]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

Can't check if a post has thumbnail adding filter to get_post_metadata()

I need to set fake thumbnails to all posts which have yet no a thumbnail. I use the code from the link core.trac.wordpress.org/ticket/40547#comment:1 But I can't check if a post already has a ...
0
votes
1answer
13 views

Something adding an excessive meta description

I have a WordPress running with Woocommerce and a commercial theme. My problem is that something is adding an extra meta tag(og:description) and it is getting on my nerve since it's content which is ...
1
vote
1answer
23 views

How can I convert postmeta from unserialized to serialized?

I'm replacing 2 fields that were previously set up with ACF and saved separately. Instead of those, I want to have 1 piece of serialized postmeta. So, I'm going from meta_key: old_key_1, meta_value: ...
0
votes
1answer
24 views

WP_Query of custom post type sorted by meta_key has unexpected results

I do not understand why my code outputs the events in a seemingly random order. It's not sorting by the start_time as I would expect. <?php $args = array( 'post_type' => '...
0
votes
1answer
19 views

How to query post with meta?

Hi newbie question just create Rest endpoint for query-specific post type is work fine but did not get data from wp_postmeta how to query related data or using other WP_ ? try meta_query but how to ...
0
votes
1answer
18 views

Use WP_query to match post types based on custom field values

i'm trying to query posts from the post type Product that match with the current post in the loop from the post type Item, based on the custom fields product-ean and item-ean. For example: i have a ...
0
votes
0answers
15 views

How to get a list of users who like a current wordpress post & remove post dislike & comment like/dislike system

I have the code, the code working fine. But i want modified somethings. //function file add_action( 'wp_enqueue_scripts', 'sl_enqueue_scripts' ); function sl_enqueue_scripts() { wp_enqueue_script(...
0
votes
0answers
11 views

Filter post by category with pagination

Hi i want to display all categories on frontend as a checkbox and filter the blog post based on checkbox selected with pagination , any help please
1
vote
0answers
14 views

get current date + 90 days and checking every day

User can submit post from frontend submission form. Fieldname: Title (entered by user) expire_date (entered by user) expire_date1 (invisible) expired (invisible) When user enter no value for "...
0
votes
1answer
139 views

Gutenberg featured image checkbox - checkbox not correctly set on editing page reload

I've followed a tutorial to get a checkbox displaying under the featured image of a post that is being edited using Gutenberg. It's a checkbox to allow the editor to control whether to display the ...
1
vote
0answers
15 views

Get Custom Logo Alt Text

I'm trying to get the alt text of the custom logo specified in the theme customization. Unfortunately this doesn't work because it seems the alt text is not included in the post meta: $custom_logo_id ...
0
votes
0answers
20 views

Displaying data from custom fields on a specific category page

I created custom fields on my functions.php page and use the values from these fields on a template-parts page (for activities). This works fine. I would like to have a page for each category showing ...
1
vote
0answers
30 views

get_post_meta not working on publishing

I'm building a notification system for a mobile app on Wordpress using One Signal. Now Supposed to when I publish a new post sends a notification to all my Application devices. The problem is I can'...
1
vote
1answer
29 views

How to display post view count by date, week and month?

I am using the below code to display post views. How can I get the data for every day, week and month? function gt_get_post_view() { $count = get_post_meta( get_the_ID(), 'post_views_count', true ...
2
votes
0answers
28 views

How to remove get_post_metadata using remove_filter inside a class?

This is the filter that i use. add_filter('get_post_metadata', array(WPKWP::CLASS_NAME, 'get_post_metadata'), 10, 4); I have to use the get_metadata inside the above call back function. If I use ...
1
vote
0answers
31 views

Need help with Google drive API [closed]

I am currently working on a WordPress website which has almost the same functionality as YouTube(log in, upload videos, create channels etc..). My requirement is, When a new user is logged in and ...
2
votes
1answer
59 views

Explanation for remove_filter used in the below code [closed]

I am very confused about what the developer has done here. This is inside a class..a filter has been added and then removed, added again. This code results in many errors as well. add_filter('...
1
vote
0answers
24 views

Should wp_postmeta meta_key always be unique for a given post_id?

I am trying to figure out a good way to establish relations between various post types. For instance, consider a post type lessontopic and another post type forumtopic. A Lesson Topic can have ...
2
votes
1answer
24 views

Options to get my custom post type metadata via the WordPress API

I am using a plugin that adds multiple custom post types all of which have their own meta-data. I am able to expose the custom post type to WordPress's API but the metadata collected with those post ...
0
votes
0answers
11 views

How i will add search option with my Custom Meta Box?

I want to add a search option with my custom meta box and also I want to confirm the user has select a value before save the post. function wporg_add_custom_box(){ $screens = ['product',...
1
vote
1answer
22 views

Saving repeated option values when querying in Published, draft and all

I have a custom query that has some repeat option values. I have three tabs that query Published, Draft and All. When under the Published tab and saving a value, it removes all the values under Drafts ...
0
votes
0answers
40 views

How to sort by multiple values in a nested WP_Query

I am displaying courses, enrollment, along with rooms whose capacities are greater than or equal to the enrollment. This query works, except the 'order' => 'DESC' for courses, and 'orderby' => '...
0
votes
0answers
24 views

How can I add a meta[] to my custom post type and search by term with the Rest API?

I just started to use the Rest API and I want to get all posts that belong to a certain taxonomy and term(s) within that taxonomy. That part is working now. Then I want the those posts to have a meta[...
1
vote
1answer
30 views

get_post_meta() not work for the first post inside the loop

I need to add a different custom class to each div inside my wordpress loop. I've read about post_class() function and filter, but I'm not sure if it's a good approach to do this. For now I have this ...
0
votes
1answer
26 views

“Enable Media Replace” plugin does not update serialized object in WPMeta

We utilize WooCommerce and a WooCommerce plugin called Product Documents (https://woocommerce.com/products/product-documents/) to associate PDF media files with products in my online store. Our ...
0
votes
1answer
26 views

Custom Field used to allow a Free Story; no longer works

Have a news site and until recently, there were two ways to get behind the paywall legitimately. First was with a user/pass that was checked against a remote database and returned an AUTH value of yes ...
0
votes
1answer
29 views

Show posts from WP Custom Post Type selected from a field in a metabox

Maybe, the question is unclear for you, but I will try to explain. There are two registered custom post types, song and album. I have a metabox on a Create an Album, in which I can select one post ...
0
votes
0answers
52 views

Issue on Getting Custom Field Value Added To the Custom Taxonomy

I am able to add a Cutom Field to The Custom Taxonomy and save it using the following code. I checked the database and the result is saving into the wp_options table like and when I try to get the ...
0
votes
0answers
19 views

I created a Custom Meta Box but it is not displaying the value on my post page

So i created a custom meta box, here is the code : add_action( 'add_meta_boxes', 'register_meta_box' ); function register_meta_box(){ add_meta_box( 'author_email', 'Author Email Id', '...
0
votes
1answer
12 views

Duplicate rows in meta table, any known relations in WC?

I am doing a migration from very old to current wordpress/woocommerce and while investigating the data I found out that there are more than one row for a products _stock meta key. The same for other ...
0
votes
1answer
23 views

How to retrieve all meta data directly from the $post object? Such as $post->related_topics?

I set up a meta field related_topics that I use to associate lesson topics to a custom post type lesson. I read here https://stackoverflow.com/questions/19640850/wordpress-how-to-return-meta-with-...
1
vote
0answers
9 views

What is proper way to store info such as user marking a post as favorite? In post meta or user meta?

I have custom post types such as course, lesson, and lesson_topic and I have ajax call to mark a lesson_topic as favorite for a user. I am currently doing this in the ajax handler: function ...
0
votes
1answer
11 views

Adding Facebook's image and meta description retrieval capabilities to a WordPress post

When a URL is shared on Facebook, Facebook is able to automatically pull a relevant image and the meta description for use in the post. Would it be possible to code similar functionality into ...
-1
votes
1answer
32 views

add multiple values (array) to post meta_input

i have a custom post type where a post is generated by a form submit. One key is an array which should be stored in a custom field... i shortended the code below to the important part -> they key is "...
1
vote
2answers
54 views

exclude posts with a specific custom field and value

How can I exclude posts with a specific custom field and value with this query? $my_query = new WP_Query( $args = array( // It should be in the first category of our post: '...
0
votes
1answer
8 views

What is proper filter or hook action to add data to the $post object?

I have a custom post type that has a one to many relationship with another custom post type. Call them lesson and topics. Currently, I get $topics as $args = array( 'meta_key' => '...
0
votes
1answer
12 views

Performance considerations - postmeta table versus new table for custom posts with foreign keys?

I am modifying a plugin that uses various custom posts types. The types are courses lessons topics At course, lesson, or topic level there can also be quizzes and assignments. ALso the ...
0
votes
0answers
34 views

Display Yoast field meta description

I found two topic about this issue but neither response exhaustively. How can I show Yoast Desciption in my code with variables? When I'm showing data directly from wordpress function get_post_meta()...
0
votes
0answers
13 views

Using meta data to retrieve related posts - a way to use nested relations?

I am modifying a site that currently has various custom post types. The structure of one to many relationships is basically course lesson lesson topic lesson quiz topic quiz There ...
0
votes
1answer
46 views

why is my postmeta table is so heavy

One of my database is realy heavy (+100Mo) for a site with not so many content (like 40 pages & 10 posts)). I found in phpmyadmin that my table "postmeta" is 95Mo. So i wonder to know what are the ...
0
votes
1answer
58 views

Why can my filter query SOME metadata but not other metadata?

I'm stumped by what seems like a simple task: I want to randomly select a post that fits certain criteria (metadata set by a specific plugin) and then return that random post to the plugin in question....
0
votes
2answers
98 views

Set Multiple Meta Values as an Array Using dispatch( 'core/editor' ).editPost() Call in Gutenberg/JS

I'm attempting to store both an Image's URL and ID in a post's meta field via a Gutenberg component, but am having trouble figuring out how to store those multiple values in an array. I can store a ...
0
votes
1answer
16 views

Show a text if the post has written by author user role in Wordpress

I search a PHP code what is show a certain text or html code on the post page when the post author is an author. (not admin or editor) When the post author is an admin or editor then show nothing. ...
0
votes
0answers
14 views

Get and Update Most Meta Value as an array in HTML form

I'm trying to update post meta for a meta edd_download_files the meta is in the form of an array. It is from a plugin so i can do it via admin, but still there is need to do it programmatically. $...
0
votes
0answers
12 views

Metadata icon/background

How can I add a background image or color to the metadata and change the clock icon? I don't really know css so I have been trying and searching for an answer whole day and couldn't find any, so I ...
0
votes
0answers
17 views

wplink dialog add metadata to field link

Am looking to modify the wplink dialog popup, so that i can add a custom metadata link from post_type portfolio. I found this post that adds a checkbox But not sure how to go about this for what i ...
0
votes
0answers
24 views

blank page with wp_get_attachment

I want to use the function "wp_get_attachment" but when I use it, my website shows me a blank page while my server locally, the function shows me what I want... I went through the canvas without ...
0
votes
0answers
167 views

Help to add Meta to Elementor

Elementor are really great useful and easy editor, but it lacks of possibility to add a custom meta, for example likes from ULikes plugin etc. For WP and Elementor exist some powerful plugins that ...
0
votes
1answer
68 views

Filter for author list in gutenberg core editor

Is there a filter to modify the presentation of certain editor editor components? For my example, I want to be able to filter the author list which is a select input in the Gutenberg editor on the ...
0
votes
1answer
23 views

Hide author from search results meta, still display date and categories

How can I hide just the author from the post meta in search results, while keeping the date and categories? I know I can use something like: .post-meta .author { display: none; } to hide the author ...