Skip to main content

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
0 answers
8 views

I am having a problem with fetching product data in the Gutenberg block editor

const allProducts = useSelect((select) => { return select('core').getEntityRecords('postType', 'product', { per_page: -1, _embed: true, }); }, [postPerPage, orderBy, order]); console.log(...
Sifat's user avatar
  • 1
0 votes
0 answers
18 views

CPT meta values intermittently return empty

I have a parent CPT (Form) and a child CPT (Registration). Form A currently has around 3,000 child registration posts. Am showing them on a custom admin table, 20 posts per page. The table columns ...
AncientRo's user avatar
  • 366
0 votes
1 answer
22 views

How can i delete default title tag from wordpress?

I used this code remove_action('wp_head', '_wp_render_title_tag', 1); to remove default title tag from WordPress. This helped the WordPress theme till Twenty Twenty One. But from Twently Twenty Two. ...
Abindra Raj Dangol's user avatar
0 votes
1 answer
28 views

Wordpress post meta key and value lookup

Correct me if im wrong but is this right when searching for poet meta key a value in Wordpress ? $args = array( 'post_type' => 'clientorders', 'meta_query' => array( array( 'key' =&...
Liam's user avatar
  • 1
0 votes
0 answers
17 views

I read the postmeta and update it without changing it, then move on to the next record

I made a survey application. The survey works successfully when I email it to 4,000 users. However, when I send it via SMS, there is an error in the numbers. The reason is that when I send an e-mail, ...
Ümüt DEMİR's user avatar
0 votes
1 answer
30 views

How to disable Yoast meta description for all pages

I am using Yoast plugin on my WordPress site, mainly for the sitemap and indexing features. My theme already comes with SEO features so now I am getting an error saying there's duplicate meta ...
houjicha's user avatar
0 votes
1 answer
12 views

Why isn't my embed_video WYSIWYG field updating when using update_post_meta?

I'm running a program which merges two posts together and each of their meta fields. I have a for loop that gathers each meta field and saves it. All of them work perfectly except for one called '...
DJZEEGLER's user avatar
  • 119
0 votes
1 answer
21 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
19 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
43 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
1 answer
43 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
19 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
19 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( $...
Jens Draser-Schieb's user avatar
0 votes
1 answer
26 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
45 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
30 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
23 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
23 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
86 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
342 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
344 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
31 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
23 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
275 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
16 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
102 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
34 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
36 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
115 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
  • 215
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
  • 215
0 votes
0 answers
30 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
151 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
200 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
1k 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
44 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
38 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
32 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
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
122 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
57 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
279 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
155 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
339 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
120 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
118 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

1
2 3 4 5
40