Questions tagged [custom-field]

Custom Fields are fields that can hold arbitrary extra information known as meta-data.

Filter by
Sorted by
Tagged with
0 votes
0 answers
78 views

Create if else for post types in WP_Query 'post__in' values

I'm trying to enable users to select individual posts by custom post type using a new WP_Query $posts = new WP_Query( array( 'post__in' => selected_posts(), 'post_type' =&...
  • 446
0 votes
0 answers
37 views

Add a "custom field" to a category that can be retrieved when viewing the category page with get_post_meta

I usually set a custom field customdata for posts and pages, that I can obtain when rendering a page with this PHP code: get_post_meta(get_the_ID(), 'customdata', true) Is there a way to set a custom ...
  • 87
0 votes
0 answers
44 views

How do i create a custom post query when the meta value is an array?

A number of properties have been imported from an external API and saved into a custom post type called 'Properties'. I want to filter these properties by the city they are located in, however it is ...
  • 1
0 votes
0 answers
24 views

wp_set_object_term via js btn frontend

Hi I just copied some code to change a post custom field term by clicking on the btn with #projects-pay-btn id and work with it on frontend as end user, but it does not working. when the user push the ...
0 votes
2 answers
36 views

Update some (not all) post titles with custom field values before running the Loop

In this project, there are custom posts with a variety of titles. In each post with the title that is the name of a person (first name, last name), there is a custom field (custom_title) that can hold ...
0 votes
1 answer
75 views

Exclude URL's from sanitize_html_classes

I've searched through the similar questions but found nothing. I've coded a meta box for adding custom URL's which get added to buttons on single posts but when the URL is added to the meta box field ...
  • 446
0 votes
1 answer
17 views

data-value for custom woocommerce field showing in code but not visable on page load

I have the code below (not written by myself) which has a li data-value populated - however this is not showing next to the date on the product page, the date is showing correctly but the location ...
  • 103
2 votes
0 answers
262 views

ACF won't load from a custom JSON location

I’m trying to set up local json sync with ACF on a multisite installation. It worked with the default acf-json folder in the child theme, but I’d like to save and load everything from the parent theme....
0 votes
2 answers
79 views

Include custom fields in search

I have a website with several custom fields, however when using the following code to search for a post, it only searches for the title or for the content, excluding the custom fields associated with ...
  • 1
0 votes
0 answers
21 views

Best way to insert a list of links into a post outside of the_content

I would like to have a list of links to PDFs on some posts that sit outside of the main content. See wireframe: The links need to be editable via the editor / wp admin and be post-specific. It's a ...
  • 101
0 votes
0 answers
41 views

Alike Shortcode using in Custom Shortcode

I'm using Alike plugin to compare my custom post types, Alike provides shortcode [alike_link] to run the procedure and I have created a shortcode to display my custom post type. In this shortcode I ...
1 vote
0 answers
20 views

Having unique constraints for custom fields in a custom post type

I have created a custom post type with some unique meta fields using the schema syntax. function register_menu_items_schema(): array { return array( 'single' => true, '...
1 vote
1 answer
208 views

Using several custom fields as custom post title

I have stumbled upon a brilliant piece of code that just fits my needs on this thread : Using custom field as custom post title by @chrisguitarguy and I was hoping there might be a way to tweak it to ...
0 votes
1 answer
89 views

Custom meta box values are not getting saved for my custom post type

I have created one dummy post type to check the values, if it's getting saved or not. However it's saving values for 'text input and text area' but remaining values (checkbox, select, images) are not ...
  • 51
0 votes
0 answers
23 views

Preset custom fields

I'm creating a wordpress plugin which will create a custom post with custom fields like "time", "rating" etc whose will be fillable in admin. So far all tutorials I've seen only ...
0 votes
0 answers
55 views

Query custom post type that has a serialized relational advanced custom field value

I have a custom post type "issues". I am using Advanced Custom Fields to add a relational field called "articles_from_this_issue" where the admin can select multiple articles. I ...
  • 175
0 votes
1 answer
312 views

update_term_meta() only updating once on certain meta keys

I set up 4 custom meta fields on a custom taxonomy, and for some reason the field values for my 2 text fields only update the first time they are added to the database. Either from including them in ...
  • 281
0 votes
1 answer
385 views

echo selected value from dropdown

This is for a custom type post, I have a custom field (a drop-down list) when I select an option in the dropdown let's say "DesignApplication" and save the post. Then when I try to update ...
0 votes
1 answer
811 views

How to get data from user meta custom fields created with acf-pro plugin?

I need to get user meta from the database and WordPress has the awesome function get_user_meta() for this purpose but, the problem is I need not default meta field. I need to get data from a custom ...
0 votes
1 answer
63 views

How To Read Read Custom Post Type Data in Headless CMS Mode

I'm doing my site with two pieces -- the headless CMS on a subdomain where content is entered, and the root domain where I display data. Only WP is installed in the subdomain, not the root domain. In ...
  • 1,765
0 votes
1 answer
23 views

Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value

My question is - I have a CPT Post name Company (CF Value - Google) and a Page titled Role (CF V - Engineer). So I want to auto-update with Post published time and date to company post and Role page ...
  • 37
0 votes
1 answer
38 views

No plugin populate user information in to form

I want to create my own form in order to get information on my site. For learning purposes, I do not want to use a plugin. So, please don't tell me to use one. I know they are easy to use, but I want ...
  • 1
0 votes
1 answer
160 views

What database state changes happen after a post is manually "updated" with no changes?

After importing a series of posts (using WP All Import), my (custom) page template is unable to access the post's contents/fields. However, if I open the post in the editor and click "Update"...
  • 101
0 votes
1 answer
22 views

how to turn a link field into a button or link text

<?php if ( bbp_get_displayed_user_field( 'youtube' ) ) : ?> <p class="bbp-user-youtube"><?php printf( esc_html__( 'YouTube: %s', 'bbpress' ), bbp_rel_nofollow( ...
0 votes
2 answers
303 views

Register PODS Custom Field with WPGraphQL [closed]

I've created a Custom Post Type called 'Item' and added a multi-upload file/image/video field type but I'm not able to figure out how to register that custom field with WPGraphQL. Here's how I ...
  • 3
0 votes
1 answer
100 views

Syntax Issue: How Do I Call A Custom Field Inside a ForEach Statement? [closed]

I used the ACF (Advanced Custom Fields) plugin to create two custom fields (news_source and news_link) for a new post type (news). I'm trying to use the following code to display the title and the two ...
0 votes
1 answer
470 views

Sort categories by custom field in WordPress admin

I know there are a lot of threads about similar issues, but I can't figure out why my custom sort won't work in the category admin page. Here is my code to add the ACF field as a column to the ...
1 vote
0 answers
42 views

Unsaved changes in metabox inputs not detected in the block editor

I have added a custom field to the regular WP post type and added a meta box to the post editor as below (it is just an example with trivial checkbox): add_action( 'add_meta_boxes', '...
user avatar
0 votes
1 answer
217 views

Filter custom post type admin list by custom meta column, where the column is another custom posts meta value

I have 3 custom post types, which are related to each other. Projects, Positions and Feedbacks. 1 Project has many Positions and 1 Position has many Feedbacks. Relations are defined with meta values. ...
0 votes
1 answer
517 views

How to add fields in custom registration form, validate it and aave to db? [closed]

I use a WP theme with a custom registration form. I want to add two fields to it (for phone number and company name). What to add to the php file of the form and what to the function file of theme ...
0 votes
0 answers
150 views

Access custom meta_data in processing order email

During a woocommerce order, I store a custom meta data inside the order. I would like to display that created custom meta data into the "processing order" email. The following code is ...
  • 3
0 votes
1 answer
81 views

Create multiple taxonomies with custom fields values on the fly when creating new posts

I have a theme that imports data, creates multiple custom taxonomies and adds them to a custom post on the fly if they’re new with wp_set_post_terms($post_id, $cast, 'cast', false); but now I also ...
0 votes
1 answer
18 views

Having Issue on Ordering CPT by Custom Field In Custom WP Query

Having a Custom Post Type loop like this, I am able to return the result on page BUT I am not able to set Order By of display using my own Custom Field. As you can see here $topic_number = ...
  • 515
0 votes
1 answer
42 views

How to fill custom fields with brackets in their key with add_post_meta()?

I'm trying to fill WP SEO Structured Data Schema fields with add_post_meta function and it doesn't work properly. I checked one of the posts that's added from Wordpress admin panel and it was saved ...
  • 103
0 votes
1 answer
44 views

Is it possible to update the dataset using update_post_meta

I am trying to create two custom fields for image and text. I have two inputs in the loop: ... <input type="hidden" name="wt_set['upload_set_img'][]" id="img" value=&...
0 votes
1 answer
61 views

How to display custom fields in hestia theme

I want to display my custom fields on the Posts page just next to the author’s details, date, and any other meta data of post in the listed posts. I already have done this in Magazinenp theme ( ID:, ...
0 votes
1 answer
486 views

display ACF repater field in archive page

I created ACF repeater field for custom taxonomy terms. Repeater consist of two field "Question" and "Answer" . By this way I want to create FAQ section for each taxonomy term. ...
0 votes
2 answers
73 views

How to update only certain custom fields in a the cache of a page?

I would like to use REST API to update custom fields on various pages - an example would be tracking outside temperature, humidity, etc from a sensor. However, if the website has cache, the pages won'...
  • 1
0 votes
1 answer
352 views

wp_query to print posts if have X custom field value

I'm trying to print posts if any posts have custom field value X. My code is working correctly but this is not working if the custom field has multiple values X, Y, Z. Location is a CF Meta and X is ...
  • 37
1 vote
1 answer
105 views

need to add custom field in more products

Hi i'm gonna be completely honest idk shiz for code i just need this to work on my site, there's a category of products that i want to have this custom field how can i code it to do that?, this is the ...
0 votes
0 answers
23 views

ACF update fields [duplicate]

I have created a field with Advanced Custom Fields that is a number field to be used as a counter. In functions.php i have created my shortcode function, and has this part: <a href="https://...
  • 1
1 vote
1 answer
559 views

Only display posts after current date

All my posts have a custom field named date-start-custom. The value of the custom field is in the date format YYYY-MM-DD HH:MM (e.g: 2021-06-15 14:30), and I want to only list posts that has a date ...
  • 41
1 vote
1 answer
116 views

Shortcode To Display Post Custom Field Value Inside Excerpt

I want to create a shortcode that pulls value from a custom field of a post and returns that value inside excerpt. I already have a function for the custom value: function geo_name_function( $atts ) { ...
1 vote
1 answer
2k views

meta_query for a string inside a meta field containing a comma-separated list

In my project the WP users have a custom meta field "usergroup" containing a comma separated list of values. The meta field can contain values like this: WS,CT,IS,TS,TS-IS,TS-WS,TS-CT Now I ...
  • 13
0 votes
1 answer
26 views

Using OR relation in meta_query to check for a value before sorting by another

I am writing a pair of queries for a site with an events listing function. Events can be either on a single date or over several (multi-day). All events have a value in custom field event_date. Multi-...
  • 39
1 vote
0 answers
22 views

How to add Advenced Custom Fields In Single Post

I Need Help, I add ACF code in single post download button showing but in link of download button same of link post, I add other website and link in button download always same, what's wrong in my ...
0 votes
1 answer
239 views

How to print Array values of custom Fields Meta?

How to print array values for custom field meta. My code - <?php $item = get_post_meta($post->ID, 'occupationalCategory', false); ?> <?php print_r( $item[0]['occupationalCategory'] ); ?&...
  • 37
0 votes
1 answer
783 views

Woocommerce products search with custom fields

i have a woocommerce e-shop website. My search is searching only in product title, short description and SKU fields. I want to search also in some custom fields (like "_barcode" and "...
3 votes
2 answers
1k views

getEntityRecord without knowing the post type

In Gutenberg there's the getEntityRecord selector that allows you to get the data of a post of a specific post type: // get the post object of a page with post id = 42 const post = useSelect( ( select ...
  • 1,696
1 vote
1 answer
479 views

How to update a meta field of type array in Gutenberg

In a plugin I'm building for Gutenberg, I register a meta field named _related_posts, which stores an array of post ids: PHP: function register_meta_fields() { register_post_meta( '', '...
  • 1,696

1
3 4
5
6 7
74