Questions tagged [custom-field]

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

920 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
619 views

'Preview Changes' for custom meta boxes?

How can I have the 'Preview Changes' working for custom meta boxes? For instance, I just want to test/ preview some text in a custom meta box but I don't want to save/ update because that post/ page ...
6
votes
1answer
811 views

How can I use order_by to order by two meta_keys without excluding posts that don't have those keys initialized?

I have two meta_keys on a custom post type. I want to be able to query all of these posts, and order them by the two meta_key, one taking precedence over the other. I.e. I have one meta_key called ...
5
votes
1answer
146 views

How can I append custom data to images in the editor?

I've added a custom meta field to my image details so that a client can add a number to their photos (a design choice). The data would need to show up under each image (like a caption) inserted into ...
4
votes
2answers
4k views

meta_query where value is equal to given value

I currently have this custom query which I am trying to filter the product (paintings) by artist. $artistID = $_GET['artist_id']; $args = array( ...
4
votes
1answer
1k views

Sorting posts by custom date fields (non standard date format)

I've inherited a website with a post type courses that has a custom field 'date-start', a Date Picker. Unfortunately the date start is stored as 'ddmmyy' and the ACF documentation implies that this ...
4
votes
1answer
1k views

Admin Area Custom Type Search By Meta Fields Without Title & Content

I have a custom post type that uses several meta fields. In the admin area I would like to be able to search by those meta fields. I have implemented this currently in my functions.php with this code: ...
3
votes
0answers
223 views

extend Meta Box / Document Panel

For a project, I'm trying to figure out the best way to implement a checkbox, related to a post type. What I'm trying to to: On the final website, there should be a dropdown-button, with upcoming ...
3
votes
0answers
1k views

Gravity Forms: Create fields programmatically

Is there any possiblity to create and manage gravity fields dynamically? I have form with ID 4 with couple fields. I want to add some fields of type checkbox with my own custom external data which can ...
3
votes
0answers
1k views

How to edit multiple post with Custom fields

I created a custom field for my post. All sounds good except for the fact that when I try to edit multiple posts (in the same time) by selecting the multiple option in the post list, I only find some ...
3
votes
0answers
39 views

How do I add custom_meta_box_id's value?

I have added custom meta boxes in post and I want to put Tag slug name in the meta box text field, and want to display the text field's texts (Tag slug name) like following this. <?php $my_query =...
3
votes
0answers
42 views

Change the RSS Publication Date to use a value from a custom field

I have a site that wants to order its RSS output by a date value in a custom field. I'd rather not create a new feed to do it -- how do I override the default feed date value?
3
votes
1answer
148 views

Function to Download External Images to My Site

I display images on my site from other sites. The URL is saved in a custom field named couv. I would like to download these pictures on to my site and create a new custom field with the new value ...
3
votes
1answer
216 views

Using a custom field value to redirect away from a 404 page

I’m moving from an old CMS to WordPress. The old articles are saved as posts and the new WordPress permalink is %post-id%. The old URL slug is unique and saved as a custom field for each post; the ...
3
votes
0answers
770 views

How to use pagination with get_post_meta

I have a Products Page that i am using to add products using custom metaboxes this is the code for my page <div class="container products"> <div class="row"> <?php $...
3
votes
0answers
2k views

Copying Custom Meta Values from existing post to a duplicate post

I'm trying to revise an existing WP plugin BU Versions to accept different custom meta field values from items I've set-up using the Advanced Custom Fields (ACF) plugin. BU Versions will copy over ...
3
votes
2answers
319 views

Extra filed under “About the user” user profile

I use the following to add Phone number,linked id etc Under the "Contact Info" in user profile. Now I have to add a filed under the "About the user". How can i do that? function my_new_contactmethods(...
3
votes
0answers
1k views

Unique key for each row in a repeater field

Is it possible to have a unique key for each sub fields in a repeater field? I don't want to use the array index, because the array index can be changed, when adding new rows between existing rows. I ...
3
votes
2answers
4k views

Displaying Meta Box Image

I have some problems displaying info from my custom meta box in my custom post type single. I'm using Reusable Custom Wordpress Meta Boxes by Tammy Hart. I'm able to display the textfields using this:...
3
votes
1answer
462 views

Change post format using custom field

I'm creating a theme using the CF Post Formats plugin. But I've run into some trouble I don't know how to solve. Here's what I want to be able to do: Create a new standard-format post Enter a url ...
2
votes
1answer
260 views

Ordering Posts Type A by Custom Fields of related Post Type B

I'm not sure if this is even possible (also posted to ACF forum https://support.advancedcustomfields.com/forums/topic/ordering-by-custom-field-of-relationship-field-object/#post-62454) I have two ...
2
votes
0answers
29 views

How to add a custom field after wp post

I want a subtitle box after the title. How to show it in the post editor?
2
votes
1answer
55 views

How to have the right design for a custom post type without accessing themes

I am trying to create a music player plugin for WordPress. Using custom post types, and custom fields, I could make posts that takes a URL and artwork. The player works based on jQuery and once the ...
2
votes
1answer
60 views

Which is best in the following scenario : post_meta vs custom table vs parent/child posts

I’m looking for a bit of advice on which way to go with a development question. I’m building a community site where subscribers create their own private posts. The data they enter falls into two ...
2
votes
0answers
294 views

How to use max and min values of custom fields

How to use max and min values of custom fields (created via ACF, repeater type)? For axample, I've custom post type 'auto' and there are a lot of models. Each post(model) has few values of price (...
2
votes
2answers
233 views

Assign Taxonomy Based on Custom Field Value

I have a custom post type "vegetables" I have a series of custom fields for each month of the year as check boxes I have a custom taxonomy "Seasons" that I want to assign based on what boxes are ...
2
votes
0answers
2k views

WooCommerce: update custom fields after checkout validation failure

In my project I'm customizing some of the WooCommerce features. My "shipping methods" are: 1. delivery 2. take away I also added a custom field in the checkout page that is a <select> populated ...
2
votes
0answers
513 views

Custom column sorting in WordPress admin post table

I have made a custom column in user administration panel showing user meta data and registered it as sortable. Made a query action to sort it by the meta numerical value (the stored user meta data is ...
2
votes
1answer
628 views

set and unset the custom field value

While showing all the posts together in admin panel, I have a custom column 'Featured Image'. And this column has a value YesOrNO. To set the column name : I have inside functions.php: function ...
2
votes
1answer
171 views

WP_Query that filters based on custom relationship field

I have two custom post types: work and clients. On the work posts I set up a custom relationship field (client_name) where you can select one of the client posts. On the work post I now want to check ...
2
votes
0answers
41 views

WP_Meta_Query causing long-running MySQL queries

I used the following WP_Meta_Query which queried posts for a specific custom fields pair. $args=array( 'meta_key'=> 'tnid_01', 'meta_value'=>$tnid, '...
2
votes
0answers
57 views

Storing data into custom taxonomies VS post custom fields (post meta)

I'm wondering what's more efficient when it comes to performing search for data. I am building a job board where I have an option to store information like: Company Name (Searchable) City (Searchable)...
2
votes
1answer
443 views

Revolution Slider Orderby Two Custom Fields

I have create Revolution Slider which load the custom post type, Events. There are two custom fields, Event Start Date and Event End Date. I would like to display order by Start and End date. Because ...
2
votes
1answer
309 views

Add custom taxonomy under the category title

I've added a custom taxonomy to my product category page in the admin. I can call the custom field using the following: $queried_object = get_queried_object(); $t_id = $queried_object->term_id; $...
2
votes
0answers
365 views

Add WYSIWYG to Image Description field

I need to build this thing: It's essentially an image with a caption, and it can go inline anywhere in the text. I could just create a shortcode for it I suppose, but I'd really like to integrate it ...
2
votes
0answers
918 views

Custom Posts Hierarchy? (State/City/Restaurant)

Question: What is the best way to create a hierarchy structure (also called parent/child relationships) between custom post types? For example, we currently have 3 post types: States, Cities, and ...
2
votes
3answers
231 views

Custom meta fields for specific custom type only

I've got a custom post type curiculum and a metabox that saves a value to a custom field. However this custom field is added to another custom post type (created by an e-commerce plugin) wpsc-product. ...
2
votes
1answer
248 views

Automatically populate a hierarchical taxonomy from a custom field

I've got a vexing how-to that I've not found any help on. I have a custom post type that has a custom field with a date in it (format: yyyy-mm-dd-t). When a post is published or edited, I would like ...
2
votes
1answer
325 views

Custom Fields vs Separate Table

I have a client who wants to be able to upload Posts using information stored in a CSV file. I've already got this portion working. Just recently, I changed the CSV File Uploader from pure PHP to an ...
2
votes
1answer
301 views

handling csv data with a custom post type

I have a custom post type which represents a 'race' and there are meta fields for 'distance' (5km,10Mile) and 'type' (track,road,crosscountry). We get the race results as a csv file which contains the ...
2
votes
1answer
44 views

How do I query for a post by custom field?

I have a custom field called "song-id" and I'd like to lookup a post by a song-id value. Can someone give me the code snippet for it? (bonus: also looking for a code to use the permalink in the post ...
2
votes
2answers
337 views

Conditional to modify query results

I'll admit, I'm not a PHP expert, nor am I familiar with all of the WordPress functions and hooks. I've been stuck on an issue, searching for help without much success, and I was hoping that someone ...
1
vote
0answers
36 views

Show custom post type relationships by taxonomy

I have two custom post types product and review. The product have a custom taxonomy fruits with terms apples and bananas. All review has a custom field that is a relationship to product, so I can ...
1
vote
0answers
30 views

get_post_meta not working on publishing

I'm building a notification system for a mobile app on Wordpress using One Signal. Now Supposed to when I publish a new post sends a notification to all my Application devices. The problem is I can'...
1
vote
0answers
49 views

meta_query BETWEEN, but the range is stored in the custom field

I've seen plenty of samples of using meta_query to find if the value is between a range, where the range looks something like this: $meta_query_args = [ 'key' => "custom_field", 'value' =...
1
vote
0answers
18 views

auto populate list of questions if user select a category xyz

I have a custom post type job with a category of different type. each type of job has it's own list of questions that I want user to answer. is there a plugin that i can use to achieve something like ...
1
vote
0answers
14 views

Product Custom Fields with HTML and JS

I have a custom textarea filed for the product page. woocommerce_wp_textarea_input( array( 'id' => '_custom_product_calc', 'label' => __('Test', 'woocommerce') ) ); $...
1
vote
0answers
7 views

How to add posts through CSV or excel file in a PHP file

I have created a page of baby names. Created it's custom fields. Added names of different religions through custom fields. Is there any way out to import names from CSV or excel file,?
1
vote
1answer
10 views

Order RSS content by an advanced custom field value

I have created a custom post-type called "event". For this custom post-type I created an advanced custom field called "event_date". Now I am trying to display the list of my events in a RSS feed. ...
1
vote
1answer
15 views

I am trying to display information from a custom table from my wordpress users pages

to preface this I know my way around a computer but I'm no coder by any means. I have a site where users can purchase points/credits to be used for a service on the site. Each customer has their ...
1
vote
0answers
19 views

Add new image block, set default class name and update it using Javascript

I am trying to programmatically set a default class on an image block, which is applied without the user manually adding it via the 'Additional CSS' field. I have tried applying a default style on ...