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
17 views

How to add a post's view count into the WordPress API response

This is my first time working with Wordpress APIs, and i'm not a PHP developer. Essentially our client just wanted us to display WordPress articles in our react-native app with simple data like the: ...
0
votes
1answer
15 views

Creating a custom post type upon registration for a specific user role

Can anyone help me to create a custom post type content when a new user is registered? But the user should be of specific role only. I have been searching but couldn't find any solution.
0
votes
1answer
21 views

Delete post meta by serialized meta value

I have some post meta entries which I like to delete from the database. The delete_post_meta() function seems the way to go: delete_post_meta( int $post_id, string $meta_key, mixed $meta_value = '' ) ...
0
votes
0answers
8 views

Metabox for searching/selecting arbitrary pages?

I'd like to create a meta box for my pages that allows me to declare arbitrary links to one or more related pages, with the idea being that I could then render these after the page content. E.g. "If ...
1
vote
1answer
13 views

Dynamic tagged image galleries

I'm creating a website for a theater company, using Elementor, ACF, CPT UI, and Jet Engine. One custom post type, "productions," includes an ACF gallery of production images. Another Custom Post Type,...
0
votes
1answer
23 views

Restrict Access to Posts based on Custom User and Post Meta Data

I have a custom Post Type called Club Pages, and a custom role called "Club Leader". Club Leaders currently can only read, modify, and delete all Club Pages posts. However, there are many different ...
0
votes
1answer
20 views

How to save a meta_value as a numeric value after I retrieve it via update_post_meta?

I tried things like $meta_rwp_user_score = (number_format_i18n($meta_rwp_user_score, 2)); , but this is not working. Where do I use that? <?php $meta_rwp_user_score['meta_rwp_user_score'] = ...
1
vote
1answer
8 views

How to update custom field in WooCommerce

I have added 2 custom fields in a WooCommerce installation using the instructions on this link. It works to save the values but I'm having some problem changing/updating values. Here is my code that ...
0
votes
0answers
9 views

Custom category taxonomy links for woo-commerce products

I am needing my woocommerce meta/taxonomy links to output in a specific way, the following code is pretty much the closest I have found/gotten: $taxonomyName = "product_cat"; $parent_terms = ...
0
votes
0answers
8 views

How to filter wp_query by huge post_meta

I have 200 different post meta value. And i create form for filter. I catch values with $_GET value and filter with meta_query. But if i check all meta values from filter form, my server down. Because ...
0
votes
0answers
7 views

Convert Eventon Timezone Meta Variable to Local time

Simply put, I want to somehow extract the event start time and event end time from the events at the following link... https://rebrand.ly/yewh1tu I know the logic of what needs to happen, but don't ...
0
votes
0answers
15 views

Check if any meta on the post has value then display content

I know how to use the conventional get_post_meta, and I usually call it with each field separately. Is there a way to use them all at once? For example, use an if statement to display content if any ...
0
votes
1answer
4 views

Using zip code to display custom data in Admin Order Details

So I am just trying to display which area of the city a postal/zip code is located in for each order. I have managed to pull all the correct data and thought I add it sorted out until I realized the ...
0
votes
0answers
15 views

Remove “Category:” from Post meta

I need to remove the word "Category:" from in front of the actual category name/link. I have checked every answer here and on other sites, and none of the answers work on my site...I have tried many ...
0
votes
1answer
62 views

Issue migrating a checkbox-type meta field to the block editor

I'm trying to add Gutenberg support to a plugin that registers a custom post type with a checkbox-type meta field called _meta_restrict, while maintaining back-compatibility with the classic editor at ...
2
votes
0answers
26 views

How to save a ToggleControl value in a meta field?

I registered a boolean meta field called _meta_restrict in a custom post type: PHP: function register_meta_fields() { register_post_meta( 'custom_post_type', '_meta_restrict', array( '...
-1
votes
0answers
18 views

Advanced Search Metabox Problem

There is no special metabox in the https://github.com/ivandoric/wp-advanced-search demo examples in this framework. Is there anyone who can help?
1
vote
0answers
30 views

How do I Implement Atomic Update of Post Metadata?

I'm building a site in which my logged-in users can "love" and "collect" posts. The number of loves and collects are stored within the post metadata using get_post_meta() and update_post_meta(). ...
0
votes
1answer
23 views

Custom Meta Box not Saving in Posts with Gutenberg Editor

I've read quite a bit of documentation around it, tons of other answers here, but I can't seem to discern why the custom meta box I'm trying to add to posts (and pages, but let's start with one at a ...
0
votes
0answers
14 views

How to speed up post list slowed by update_meta_cache()?

Having run Query Monitor on my site, the post list for a custom post takes 18.17s. Query Monitor advises 2 Slow Queries, including... SELECT term_id, meta_key, meta_value FROM wpcxt_termmeta WHERE ...
0
votes
1answer
22 views

How to Display Image Caption but Not Alt Text

I'm trying to display images with their caption, but when I do it displays both the caption and that alt text. I've tried to use unset( $fields['image_alt'] ); to hide the alt text, but it does ...
0
votes
1answer
16 views

if in category but only with post meta

Working on an if statement to display text only if it's in a specific category WITH specific post meta. If the post meta doesn't match but it's in this category, the text should not display. This is ...
2
votes
0answers
23 views

How to store Gutenberg ColourPicker RGBA as metadata

I'm trying to build a sidebar plugin for Gutenberg which uses the ColorPicker component to store a chosen rgba value in metadata using withSelect and withDispatch (I'm testing below with the hex value)...
0
votes
1answer
14 views

Migrating meta_key and meta_value from old theme to new one

I've just installed a new theme for my wordpress website. ( Jannah Newspaper Theme, to Bimber ) My website is a platform for posting music videos. Jannah Theme have stored all my embed video posted ...
0
votes
0answers
20 views

URL from get_post_meta() is broken my URL

I'm just another biginner on PHP and wordpress. Well, I've used another code to get meta data and use it as a link in my blog. Everything is fine, but the link is incorrect, wordpress add the website ...
0
votes
0answers
16 views

Checking for post_meta before using hook wp_insert_post_data

This works well but I am trying to check for post_meta before processing the hook. This script is based off this thread: Force Custom Post Type Status to 'Future' on first Save or Publish ...
1
vote
0answers
72 views

How to display singular form of category name?

I have the following code to show the names of the categories for a single post. My categories are named in the plural (i.e. articles, letters, translations, commentaries, etc.), but in this function ...
0
votes
0answers
17 views

Update post_meta table from other database

I need to take values from an old database to a new one. Specifically a plugin's meta value of WooCommerce products. I've got the same products data in both tables but the IDs are not coincident, so ...
0
votes
0answers
20 views

How to add html to the meta box display area?

I am a blogger, don't know much about code. I have created a meta box follow the instruction Article source link for posts. However, it cannot insert a href link and , . Code: /* Define the ...
0
votes
0answers
22 views

In ACF, create list of terms to be selected by another ACF option elsewhere - is it possible?

What I need to do, is on my ACF Options page, have a list of 'Terms', or actually they will be an enumerated list of 'Categories', which can then be selected from to set another field elsewhere in my ...
0
votes
1answer
24 views

Display posts from multiple value in meta separated by comma

I have got main product with meta key: addons and meta values in this key: 129456,968945,495435 Each of these three numbers is the key with these meta values. For example: Post 1: meta_key: ...
0
votes
1answer
28 views

How to select a paragraph other than the 1st to be the post's excerpt?

My WordPress website has 3 paragraphs and one featured image in a post. How do I make the last or last before para to be the post description?? Are there any plugins to do that? Am already using All ...
0
votes
0answers
18 views

Woocommerce - Output extra product meta under SKU -

so I have been trying to figure out how to create custom product meta for the product metabox. I have been able to create a field in the back-end that allows me to input a custom SKU. I have found the ...
1
vote
1answer
37 views

How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)

Sorry guys, had to post this again as site wouldn't let me respond to comments (new account). I have been working on some code to decrease quantity of a variable product based on the numeric values ...
1
vote
1answer
26 views

Add a date updated/date modified option using custom fields

I run a news website, and I think there are considerable benefits to adding a last date updated option to it. However, everything I see online is for replacing the published date with the date ...
0
votes
0answers
26 views

How to see VAR_DUMP() or check value of post_meta for 'woocommerce_order_item_quantity' filter

I have been working on some code to decrease quantity of a variable product based on the numeric values of a custom field. This is working fine, however I have implemented a checkbox that will ...
0
votes
1answer
13 views

If I disable screen options, does WP still try to update post meta?

I am trying to speed up my WP admin post edit page. (/wp-admin/post.php?post=x&action=edit) This particular site has WooCommerce + other plugins that generate a lot of post meta installed. Most ...
0
votes
0answers
24 views

Woocommerce - Save custom field so shows in Order details and emails to user

Hi I want to add an input field onto the order page where I can add a Serial Number once a customer has ordered a product. I would like this to go under the Order details. I know you can add notes ...
0
votes
0answers
16 views

Update Post Meta not working for Custom Post Type

I am trying to fetch the data from the database and update the post meta. Everything is perfect. I have even checked each variable. The method is also firing only once. The problem is that in the ...
1
vote
1answer
25 views

How to programmatically customise the Contact Form7 notification email prior to sending?

I have post_meta that I do not want displayed or accessible in source when viewing a post, but I would like the post_meta to be included in email responses. How can I achieve this? I'm using ACF to ...
1
vote
0answers
61 views

ACF Upload Image in repeater from front-end with custom form? - add_post_meta()

I want to upload images in the ACF repeater. That repeater means the gallery of page. Point is to create post in custom post type using add_post_meta() method. Here I have the form : <input type=...
0
votes
1answer
28 views

How to update/add child posts meta whenever the parent post meta is updated?

I couldn't find a solution to a very simple problem. When a meta value for the parent post is updated, I want the meta value of all child posts linked to this parent post to be updated. For example: ...
0
votes
0answers
31 views

ACF Group Field in add_post_meta?

how I can fill field in ACF Group Field in add_post_meta? This is maybe useful, I tried something, but it doesn't work. $values = array('value 1', 'value 2', 'value 3'); Now the code to insert the ...
0
votes
2answers
53 views

Like & Dislike functionality using JavaScript

I want to add Like & Dislike functionality into my custom post type, called game. I have placed like and dislike icon links in my post footer. Desired Behaviour: When a user clicks the like ...
1
vote
0answers
29 views

Creating user status mode in WordPress

A few days ago I came across a site. The site had a status where a user could post their status about that post. There were five modes: I've seen this anime I'm watching this anime See this in the ...
0
votes
0answers
11 views

How to add values in the custom fields(name and value) provided in the product page in the backend?

I want to add some values in the custom field provided in the product information page in the backend. How do I do that?
0
votes
1answer
51 views

update_post_meta not working with transition_comment_status

I'm trying to save an average of comments as a post meta that needs to be updated every time according to comment status. /** * Gets comment average data. */ function sw_get_averagerev( $post_id ) ...
0
votes
0answers
14 views

How to structure numbers of posts accessed by a user in a membership site?

I have a Custom Post Type named Deals in my site. On each Deal page, I have a button which only users having membership access can view it. On clicking this button, a random coupon code in generated ...
0
votes
0answers
28 views

How to modify default meta link format

I want to change the URL for the author meta next to all the posts. I don’t know where WP pulls this from, but it’s now a link to (essentially) ../author/%POSTAUTHOR%, or whatever the field name is. I ...
0
votes
0answers
29 views

Wordpress Blocks, setAttributes not saving

My block seems to work correctly, unfortunately none of my metadata gets saved after saving the article. You can find source code for my block in this repository. It simply adds a toggle to set a ...

1
2 3 4 5
36