Questions tagged [post-meta]
Post meta is a data set containing additional core as well as custom post information.
1,963
questions
0
votes
0
answers
11
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 "...
0
votes
0
answers
35
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 ...
1
vote
0
answers
14
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 ...
1
vote
1
answer
23
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 ...
0
votes
1
answer
20
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 ...
0
votes
0
answers
7
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 ...
0
votes
0
answers
17
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 ...
0
votes
0
answers
25
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 ...
0
votes
1
answer
34
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, '...
0
votes
1
answer
63
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 "...
0
votes
1
answer
265
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 ...
0
votes
0
answers
29
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(){
...
1
vote
0
answers
21
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 ...
0
votes
0
answers
10
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 ...
0
votes
0
answers
27
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(
...
0
votes
0
answers
17
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 ...
0
votes
0
answers
30
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 ...
0
votes
0
answers
20
views
Translation related post text to Arabic
I have website with Arabic and English language,the main language is English, I used polylang and loco plugin for translation, I used elementor plugin, the title of related post is input value in post ...
1
vote
0
answers
34
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 ...
0
votes
2
answers
81
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/...
1
vote
1
answer
44
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 ...
0
votes
0
answers
188
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 ...
2
votes
1
answer
54
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 ...
3
votes
1
answer
139
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 ...
1
vote
0
answers
87
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 ...
0
votes
0
answers
57
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 ...
0
votes
0
answers
36
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 (
...
0
votes
0
answers
24
views
if condition from post_meta not working in save_post
I'm new to Wordpress, and I am trying to make a condition to run something in save_post if a checkbox is enabled.
Right now my code is like this:
add_action( 'save_post', 'ac_verifica_links' );
...
0
votes
0
answers
197
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 ...
0
votes
1
answer
91
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 ...
0
votes
0
answers
52
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 ...
0
votes
0
answers
40
views
What effect can a large wp_post table have on overall site performance?
I am interested to study the effects that a large wp_posts table may have on site performance. In most WordPress sites, I imagine there’s a lot of unnecessary database data such as post auto saves, ...
-1
votes
1
answer
44
views
How to display Author Profile based on Custom field value
I need to display additional author profile based on Custom Field Value.
I am using native wordpress custom filed declaration. so for my custom field name is
$coauthor = get_post_meta( get_the_ID(), '...
0
votes
2
answers
135
views
Save frontend submission form field as custom field
I use plugin for submitting posts from frontend. It's a field builder.
Maybe it uses wp_insert_post() function, I really don't know.
Here I use my custom shortcode, please check here for the code:
...
0
votes
0
answers
13
views
Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key "filmmaker" more than once)
My page should display all filmmakers, that have been tagged as "filmmaker" in my posts. I do have posts that feature more than one filmmaker (meta_key = filmmaker) in custom fields, but ...
0
votes
1
answer
21
views
How to show wordpress post in the site based on custom field value?
Each of the wordpress post has one custom field as match_time. The value of match_time can be finished/live/not_started. I want to show posts which has match_time "live" on top, and then ...
0
votes
0
answers
88
views
get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post
I am trying to change the title of a custom post type "property", i tried many ways.
publish_property (ref: {$new_status}_{$post->post_type} Link)
save_post (ref: save_post Link)
...
0
votes
0
answers
319
views
Cant create or update meta fields using WordPress REST API
I have wp theme with custom fields in posts with following meta keys in photo, can't create post with custom fields values using rest-api (I'm able to create posts with no problem but cant edit or add ...
0
votes
1
answer
153
views
Filter posts by meta key
I would like to implement a search function where a user can enter an amount($amount) and based on that argument the search result needs to show all posts where $amount >= loan_min (meta key) AND $...
2
votes
2
answers
973
views
Update post meta custom field using block editor
I have a custom mapping plugin that (among other things) saves/updates coordinates to a custom field when the user drags a map marker within a custom block. Everything works as expected except for the ...
1
vote
1
answer
334
views
How to properly use oneOf and anyOf in Rest Schema?
I have asked this before at Stackoverflow, now I'm here to be more wp specific and bring more context - as I did some advance on this.
Seeing this use of oneOf has made me change my schema to this ...
1
vote
1
answer
84
views
Generate metadata for cloud images
The current situation
We use the AWS SDK for PHP to store media files on S3 instead of the server's local storage, and use the wp_handle_upload filter to point the inserted attachment to the S3 file ...
0
votes
1
answer
86
views
Add post's category as a meta tag to the post
For tracking purposes, I need to add a meta tag to each blog post with the post category it's in.
The meta tag would need to look like this:
<meta name="category" content="politics&...
3
votes
0
answers
82
views
How do I manage custom meta in post revisions in the Block Editor era?
Note to admins: I have been trawling every possible resource for this but cannot find a good answer for modern WordPress, so please don't mark this as a duplicate of ("insert some answer from ...
0
votes
1
answer
27
views
Display current ranking of post as a number in post title
I have a page where people can rank stuff. My posts are ordered by the current ranking which is stored as a meta key in post meta.
Now i want to add the current ranking spot within the title of the ...
0
votes
0
answers
42
views
Search post overlapping dates - meta_query with meta_key
I'm having a search form for rentals that search locations available according to a date range.
For now, I store all reserved dates for each posts as post_meta. For exemple ;
post_id: 231 post_meta : ...
0
votes
1
answer
116
views
Meta field bulk editing no longer working in WP 6.0 [closed]
Until recently, I was using the following PHP and jQuery code for adding bulk editing support for a meta field (price) in a custom post type (Book):
PHP:
function show_bulk_edit_book_metabox( $...
0
votes
1
answer
105
views
Conditionally run function based on custom meta value?
I’m looking for a way to conditionally display an image within certain Woocommerce hooks that I choose based on whether a value is true within a custom meta field for the products on my site.
For ...
0
votes
1
answer
52
views
What snippet do I need to type to show my ACF field show up on my theme?
I've been trying all kinds of things but I can't get it to work cuz my Theme single.php looks different that usual.
I made a field in ACF named Region and then enter for example USA which I need to ...
0
votes
0
answers
142
views
Insert Custom Field Value
I want to insert custom post type with it's custom fields values
I have found this method to insert custom post type but with no custom fields
wp_insert_post( array $postarr, bool $wp_error = false, ...