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
1 answer
16 views

Quering a post object based on another related post object

I have two post types - Ticket and Event Each ticket has a meta called 'event_id' which connects it to an Event. Suppose I want to fetch all events with more than 3 tickets. I want to do it in a ...
mrkarma4ya's user avatar
0 votes
1 answer
11 views

How to update post view count?

I am adding post view +1 whenever someone is loading the page in wordpress. so everytime someone reloads it automatically gets +1. this will cause to store very large value in meta value. is it ok?
LM10's user avatar
  • 1
0 votes
0 answers
32 views

rest_api_init is not getting invoked inside a Class

When I include the code to expose custom post meta using the rest_api_init hook outside a specific class, it works perfectly, such as in the functions.php file. However, when I place the same code ...
Saqib Ali's user avatar
0 votes
0 answers
31 views

How do I access the current post object within a block theme template or pattern?

How should I be able to query things like specific metadata or any other thing from the post object? Apparently I don't have access to basic functions like get_the_ID() or similar functions inside ...
thebigJ's user avatar
0 votes
0 answers
16 views

Force post update with React

I'm creating a plugin and I have added a custom settings panel in the editor sidebar. In my settings panel I have a couple of text inputs and a custom button that calls an endpoint to pass some data ...
TsvetkoKrastev's user avatar
1 vote
0 answers
18 views

How can meta values from another site in a multisite be used in a custom query?

Currently, I am using the pre_get_posts action to create a custom query, ordering the posts based on a meta value like so: add_action( 'pre_get_posts', 'my_custom_order' ); function my_custom_order( $...
berlinersueden's user avatar
0 votes
1 answer
21 views

How to handle custom taxonomy archive when no posts will have that taxonomy

I have a hobby site where I record the changing tenants of a big shopping centre. For each tenant I create a post and use a ACF repeater to store the unit they are in and open/close dates. The unit ...
Damien Carbery's user avatar
0 votes
0 answers
18 views

How can I create Woodmart theme "linked variations" through REST API?

I want to create and call linked variables via REST API. Woodmart theme itself has created a post type named "woodmart_woo_lv". And this type of post has three private meta fields named: ...
AminAli's user avatar
0 votes
0 answers
24 views

How can I list all the meta in a custom taxonomy?

I have a site that has custom post types and corresponding taxonomies. I'm trying to create a new archive page for each taxonomy. The problem is that I don't know how to find the actual name of the ...
pressword's user avatar
  • 360
0 votes
0 answers
15 views

Search posts by meta key in admin and front

i want to search post by meta key and title. but when i use blow code search just meta key. how can i solve that? function extend_admin_search( $query ) { $post_type = 'post'; $custom_fields = ...
ReZa's user avatar
  • 1
0 votes
0 answers
22 views

add a meta value to the shortcode twice

I would like to build a shortcode looks like below. [employee_session trigger=session-popup-1 trigger_type=id in_dialog=1 employee=1] [employee_session trigger=session-popup-2 trigger_type=id ...
futureyoon's user avatar
0 votes
0 answers
20 views

SQL query based on two different custom field values

I have custom post type "store" that has two different custom fields: Coutry and City. When in the single country page I list all the stores in that country. What I would like to do is to ...
chaq's user avatar
  • 1
0 votes
1 answer
66 views

Update post meta array - add new, single value

What i'm trying to do - i have meta field in post with array of user emails, i'd like to add new user email(if it's not there already) with each submission of Contact form 7. Here's what i managed to ...
Nikson's user avatar
  • 15
0 votes
0 answers
14 views

Custom fields with value not pushing with wp_remote_post to wp site

I want to share current post to another WP site with wp_remote_post function, so i created a post template and then select that to remote site with submit button. I have created code it's working fine ...
Puneet's user avatar
  • 47
0 votes
0 answers
6 views

Add default meta data to a page/post template

Creating a Gutenberg template and populating it with default content is as simple as defining the initial content inside a file of the templates directory of a theme and the defining said template in ...
Walrus's user avatar
  • 131
2 votes
1 answer
200 views

Block Editor - Meta values not saved, meta changes to empty array on update

Issue TL;DR I have a block that updates meta values, but when I click 'update', the values are not saved for the post. Additionally, the meta values I get from useEntityProp load as an object with ...
Baerkins's user avatar
  • 163
0 votes
0 answers
13 views

Normal Posts and Custom Posts with Date Query

I have a custom post type with a date query and these posts only shows on the post archive list when I create a normal non custom post and save this normal post then both the custom post and normal ...
Angel Hess's user avatar
0 votes
1 answer
221 views

getEntityRecords/useEntityRecords: How to use CPT metadata?

I use getEntityRecords as described in the official data API tutorial (https://learn.wordpress.org/lesson/retrieving-wordpress-data-records/). I.e.: const [searchTerm, setSearchTerm] = useState( ''...
gresch's user avatar
  • 111
0 votes
1 answer
27 views

Hide username from blog post source code

I discover some of failed login attempts on website i manage, some of it the attackers know the username who published the post, i looked into wp-json and it is not show or leaks anything. but when i ...
Yehia Gamal's user avatar
0 votes
0 answers
22 views

wp_update_post function exclude specific field

I am using a function to update the default post and this function updates the language post publish date and some fields. it's working fine but the problem is that our meta_post field "_mydomain&...
SS Apps's user avatar
0 votes
1 answer
144 views

Cannot read properties of undefined (reading 'useEntityProp')

I'm working on a custom block and want to store some values in meta instead of the properties. So I followed the instructions from here Meta Boxes | Block Editor Handbook but after building the block ...
Marcel Hauri's user avatar
0 votes
0 answers
13 views

Filtering Tabs in a Custom Post Type's Edit Page

I am using LearnDash to create courses on WordPress. A key thing is that I have other non-admin instructors that will also help me create lessons. The thing is, the lesson edit page has a "...
The Feadow's user avatar
0 votes
0 answers
85 views

Force-update the meta variable first set using `var [ meta, setMeta = useEntityProp( 'postType', postType, 'meta' );`

Context: I've got a plugin that triggers some actions when a post is saved, like contact an external API and save the result as a custom field. All of this happens in the background, using PHP and the ...
Jan Boddez's user avatar
1 vote
0 answers
30 views

Wishlist Icon in Divi Blog module (loop)

I use the Divi Blog module (loop), but it lacks some functions. So with a childtheme and code I retrieve post meta in the Divi Blog Module, thats all working fine. But, I also want a working wishlist ...
Joyce's user avatar
  • 11
1 vote
1 answer
33 views

What is the best way to get a different post's custom field/postmeta with js?

In gutenberg I want to get a postmeta (it's a json string) that belongs to post #123. I want to check the editor's content against it. Let's say that postmeta's key is "blocks". So I made ...
user18102663's user avatar
0 votes
1 answer
91 views

How to append $metadata['sizes'] to metadata when using 'wp_generate_attachment_metadata?

When a file such as an image is uploaded, an optimized version is created with $saved = $editor->save($editor->generate_filename('name'));. This successfully writes the file to disk and the ...
Motivated's user avatar
  • 205
0 votes
0 answers
8 views

WP_query 'orderby' with array and if first variable value missing then put last and only sort that by the second variable

Some of my Custom Post Type (CPT) 'player' has a value entered for ACF field 'player_personal_player_number', some 'players' do not have a number. Trying to display the 'players' by number (ASC) first ...
piet's user avatar
  • 111
0 votes
0 answers
23 views

How can I get or the intermediate size of an image with wp_get_attachment_image_src without using post meta?

I'd like to get the name of an intermediate file based on it's original attachment without relying on its post meta. As the registered image sizes e.g. thumbnail have been unregistered, the post meta ...
Motivated's user avatar
  • 205
0 votes
0 answers
28 views

Calling metadata in a single.php file

In the following code:<?php echo "codice alloggio: ",get_the_ID(), colormag_entry_meta(); ?> How could I add metadata values after get_the-ID? In particular I'd like to call the value ...
Andrea Sacconi's user avatar
0 votes
1 answer
85 views

Getting author's nickname as meta value

This is code I set on function.php I made it to have original author's nickname as custom value. function data_nickname( $post_id, $post, $update ) { $data_nickname = get_post_meta($post->ID, '...
cwhiro's user avatar
  • 25
0 votes
1 answer
161 views

get Custom field label (select/dropdown) on front end

I have custom field added to product posts. This is dropdown field and displaying on front end it pulls the option value which is not display friendly, for example select option value is "...
Damir Gasparlin's user avatar
0 votes
1 answer
848 views

How to modify default <meta> tags in wp_head()

I am looking to do some on-page SEO, wherein I want to limit the length of Title, Description, and more in my HTML meta tags. Is there anyway I can access metatags already present in wp_head, and ...
Amit Bajar's user avatar
0 votes
0 answers
37 views

add_post_meta not working within AJAX function

I'm passing some data through AJAX to a function in my functions.php, and am trying to save that as metadata to post '101' with a key name "test1". My PHP function is: function fztest(){ ...
BrassMonkey's user avatar
1 vote
0 answers
35 views

Extend file format support for post thumbnails

I am trying to enable video thumbnails for posts in my theme. I created a custom post thumbnail media uploader in an editor plugin as follows (This is necessary, because the default uploader can't ...
TimMKuehle's user avatar
0 votes
0 answers
16 views

Search for meta_query does not return any result if combined with title

I'm trying to extend the wordpress search to include a custom cpt through the meta value associated using an ACF. All seems to works great, but the main problem's that I have to add this code to make ...
sfarzoso's user avatar
0 votes
0 answers
31 views

How to get posts that have certain meta key value and order based on another meta key's value

Here is the code I gathered off the internet so far: $args = array( 'post_status' => 'publish', 'posts_per_page' => '5000', 'post_type' => 'post', 'meta_query' => array( ...
Petar Vasilev's user avatar
0 votes
0 answers
19 views

get_post_meta() doesn't allow email

I have a WordPress theme in which employers can post a job that is available in their company with all the requirements details and apply link and one job page gets created where those who are looking ...
Abhiupadhyay's user avatar
0 votes
0 answers
98 views

How to make internal links creating plugin to respect ACF?

I am using ACF for displaying a post with different types of contents (some text, it's explanation, it's translation, it's authenticity, it's scholors ect). Recently I tried a number of internal link ...
Mg Bhadurudeen's user avatar
1 vote
0 answers
36 views

Post meta box data not saving

The meta box, fields, etc. are all displaying correctly but when I go to update the page it seems the data in those boxes has not saved. Any ideas? Using a custom post type called 'question'. Would be ...
Tom Foster's user avatar
0 votes
2 answers
106 views

Why is my Toggle field not showing in Gutenberg?

I am adding a PluginSidebar to Gutenberg and it works until I try to add a meta field to the sidebar. Then it doesn't work. I'm not sure why though. import { registerPlugin } from "@wordpress/...
JayDev95's user avatar
  • 179
1 vote
1 answer
53 views

How do I add the "orange counter" next to a Custom Post Type?

I'm currently building a plugin for a client, where users can book meeting-rooms from the frontend. Then AJAX will create a custom post type, and an email will be sent to the site administrator. All ...
WPTricksDK's user avatar
0 votes
0 answers
264 views

Extend search query to search meta keys values based on search string

I want to create an autocomplete AJAX search and I'm trying to have it where when the user starts typing, the list populates titles matching that search string. My issue is in the WP_query, because I ...
Derek's user avatar
  • 373
2 votes
1 answer
116 views

Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)

I have a weight class category, where I want to sort by weight so Heavyweight shows at the top, and Flyweight at the bottom. I have created a custom meta field called 'weight' where I store an int ...
Mac Cooper's user avatar
3 votes
1 answer
275 views

A better way of getting draft posts that has a particular post meta using get_posts function

I'm developing a simple WordPress plugin as part of my WordPress learning. It's about bulk post approval. The full plugin code is given in this question: Bulk post approval and publishing doesn't ...
Karma's user avatar
  • 176
1 vote
0 answers
107 views

Saving multiple custom meta box fields

So, I have a custom metabox, with multiple fields on it, and the amount of boxes is variable (could be 3, could be a lot more, depending on order quantity number) I'm trying to write a save function ...
Mark Tabner's user avatar
0 votes
0 answers
113 views

How to add new Metadata options (Date, Author, etc.) for Posts?

I would like to know if it's possible and how to create new Metadata options (like Date, Author, etc.) to show about a Post. I tried using Advanced Custom Fields, but I can't seem to use the custom ...
Giacomo Simonin's user avatar
0 votes
0 answers
39 views

How do I get a function to work in single.php

I have a code. add_action( 'init', 'njengah_change_post_date_programmatically'); function njengah_change_post_date_programmatically(){ $time = current_time('mysql'); wp_update_post( array ( ...
Guruh's user avatar
  • 3
0 votes
0 answers
342 views

After a while attachment meta data is missing "sizes" data

We like to use custom image sizes for custom WP themes. This way, we can provide appropriate images for the custom elements and we can ensure that images don't load too large or too heavy. Now we've ...
braam's user avatar
  • 1
0 votes
1 answer
133 views

WP_Query by meta key not returning any posts

I have set a custom meta key 'post_views' on a custom post type which I can see in my database has been added for 3 posts. I now need to retrieve the ID's for these posts by searching for all posts ...
Dgeorgex000000's user avatar
0 votes
0 answers
126 views

NewsPaper WP Theme - Additional Related Posts Filter by Time (divTag composer)

I have specific situation here and really need help from someone who has experience with NewsPaper theme and tagDiv composer as well. I want to add new function (or alter current, nevermind) that will ...
ZeusDev's user avatar

1
2 3 4 5
40