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

learn more… | top users | synonyms (2)

8
votes
3answers
29k views

How to Add Custom Fields to a Custom Post Type?

Ok, so I have registered a few custom post types and a few taxonomies. Now, for the life of me, I cannot figure out the code I need to add a Custom Field to my Custom Post Type. I need a drop down ...
0
votes
1answer
20 views

How to check custom fields from functions.php

I'm trying to hide certain menu items based on the custom fields on a page. I could use CSS or a script to hide the items, that's not the problem. What I don't know is how I can check the custom ...
0
votes
1answer
50 views

Insert image into sub-field with update_post_meta

I found out that I could insert an image into a custom sub-field by just adding the image ID: update_post_meta($post_id, $metafield, 168); But that was a lucky guess - I didn't see this info on the ...
2
votes
1answer
33 views

get_field not displaying my custom field value

I'm asking regarding the ACF plugin (Advanced Custom Fields) I'm working on creating a category group that will add custom fields to the category pages. These are the fields: They seem to work in ...
0
votes
0answers
45 views

Save WooCommerce custom field values without “Updating” Admin Post

I'm creating a website that is on the WooCommerce platform and what I'm essentially trying to do is add another option to the sorting feature of the plugin by using a manually created custom field ...
1
vote
0answers
37 views

Default Custom Field Value Automatically Update

I have created a hidden custom field with a php function as its value. Like so -- $value_rating = get_post_meta($Property_Id, 'vr', true); <input type="hidden" name="vr" class="form-control ...
0
votes
1answer
17 views

Save Custom Meta Value on Media Upload

I am looking for an option where a custom meta value will be saved when user uploads an attachment. Lets say I need a meta key _example_meta_key and want to save meta value of this as ex087659bh (It ...
0
votes
1answer
13 views

Select multiple options in WordPress custom meta filed

I have added select box using meta box in post. I try to select multiple options in select box but did't save multiple option in post meta. Only select last selected option. how to save multiple ...
0
votes
6answers
4k views

Preserving line breaks when saving and displaying custom fields data

I'm collecting data via a form plugin and saving that data in form of a post with several custom fields. I then display the content of the post and the custom fields on my post template using... if( ...
0
votes
2answers
32 views

Wordpress custom field sorting, weird behavior: the latest post is at the end

I am using Wordpress with Advanced Custom Fields. I have a custom post called "event" with a custom field "date" (I have added the field through ACF). The date field is formatted in the following way: ...
5
votes
2answers
159 views

Having different sidebar content for MANY pages?

I am continuing on from a topic I already posted but with a different angle. Please bare with me as I try to provide as much information as possible. I am looking to add a simple text area called ...
2
votes
1answer
20 views

Call a custom field in an audio shortcode?

I'm attempting to call a custom field in an audio shortcode. The field I'm calling, enclosure, defines MP3 files that are associated with my respective posts. I'm using the PHP template editor in ...
-2
votes
2answers
68 views

How to display search query as formatted text?

I am trying to display a site vistors search query on the search page. The form has custom fields so is not showing if it's "Search" and it doesnt show none of my custom fields. My search form - ...
0
votes
1answer
18 views

Delete custom post type metadata without deleting the post in admin area

I'm working on a plugin for a client and they need the ability to attach a couple of PDFs to a post as metadata. The client will need to occasionally update these attachments but without deleting the ...
0
votes
1answer
25 views

Passing the custom field values in the wp_get_current_user array function

How to pass the custom field values which were stored while creating a new user into the wp_get_current_user array function When I call the wp_get_current_user() function the result which I found is ...
0
votes
0answers
38 views

Add Custom Fields To Variable Products WooCommerce

I am working with the most recent version of WP, AVADA THEME, and WooCommerce. I have variable products which require the shopper to select COLOR, SIZE, and MATERIAL to dial down to the correct ...
0
votes
0answers
21 views

Find page metadata in database

I want to insert metadata to custom fields (from "advanced custom fields" plugin) manually (with wp_update_post_meta). I need to know how the meta value strings look like so I can insert this kind ...
0
votes
2answers
44 views

How do I implement custom fields without using any plugins?

I am trying to create a member directory and using a custom post type members. I am familiar on how to use the ACF plugin but is there any methods on how to associate a custom field for a specific ...
0
votes
1answer
24 views

Retrieve value of a category's custom field

Using the 'Advanced custom fields' plugin I have added a field to every post category that is called 'color' and it works just fine. Now inside the loop I need to retrieve the value of the 'color' ...
1
vote
1answer
26 views

Custom fields not getting saved in the databse when added to the add new user profile page

I want to save the custom field values in the wp-users table. Do I have to create the fields(client and user_groups) in the table or it gets created automatically when the data gets saved into the ...
4
votes
1answer
76 views

How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”

How to remove profile picture section from WordPress admin panel or the link "You can change your profile picture on Gravatar." add_action('admin_footer-profile.php', 'remove_profile_fields'); ...
1
vote
0answers
15 views

Show values of custom post meta on 'Add new post' page?

I am developing a website in which I am giving my users a separate profile. Their profile includes a dynamic slider. I made a custom post type named 'Slider' and added all images using: ...
0
votes
0answers
12 views

How to add all the number given in field of metabox of wordpress?

I have added a field called number of question in post meta box. THe feild name is no_of_question. To get the number of question i can do echo get_post_meta($post->ID, $field['no_of_question'], ...
0
votes
0answers
17 views

Save custom post data outside of default post form

I have some text inputs in my post editing screen. I can't have them in the standard metaboxes and they are outside of the default post form. <form name="post" id="post" action="post.php"> I ...
1
vote
1answer
14 views

custom-meta-box checkboxes from loop won't save

I tried to create a custom meta box with checkboxes, generated from a loop of a custom-post-type. I found this example here on WP Development, but I can not figure out why the boxes won't save. My ...
1
vote
1answer
30 views

Calculate all custom field values in the post loop

I have a custom post type named 'ordered_food' and the custom field named 'price', Alhough I can print out all the values, I don't know how to plus and calculate the total price. Because it's already ...
0
votes
0answers
18 views

Create plugin to modify custom field values

I've developed a plugin which outputs a list of events into a widget. To display event details I created a generic page with shortcodes and the plugin populates shortcodes with event details. This ...
0
votes
1answer
48 views

`update_post_meta` not working anymore

Originally my goal was to compress my code, now after I altered it, it is not working anymore. I can't figure out why. I simplified it a bit, now this code should save one date entered in the backend ...
0
votes
1answer
66 views

Woocommerce frontend edit custom fields

i have add 4 custom fields in the checkout page (in functions.php ) Now i show the value in the Order page with get_post_meta( $order->id, 'My Field', true ) I need that the customer can edit ...
1
vote
2answers
6k views

Woocommerce with metabox plugin

I'm using woocommerce as my e-commerce solution and the metabox plugin ( http://www.deluxeblogtips.com/meta-box/ ) to make my life a lot easier when implementing meta boxes. I've never had any issues ...
0
votes
1answer
49 views

Display WP-Types custom fields in post [closed]

I have a WooCommerce website where on products I added some custom fields using WP-Types plugin. The website has a section "News", which basically is a blog. How can I insert wanted products into a ...
0
votes
2answers
41 views

Add multiple meta keys to a post at once

I figured how to add an input value as a meta key value to a new post from a frontend post form (thanks to @thedeadmedic), but I can't figure how to add two or more meta keys at once. Is this possible ...
0
votes
1answer
34 views

display custom media folders to wordpress media popup

I have plugin "Maxgalleria Media Library Plus" in my wordpress site, where I can organize my images in different folders.When I look via FTP, in the uploads directory there are all folders I have ...
0
votes
0answers
16 views

Get options from a select custom field

I've created a select custom field with different predefined values. I've done this using the Types extension for WordPress. Now I'd like to create a function to retrieve all the values that this ...
12
votes
1answer
30k views

WP_Query - Order results by meta value

I've checked around and haven't seen an answer which works as of yet. I have a WP_Query with the following arguements: $args = array( 'post_status' => 'publish', 'post_type' => ...
0
votes
2answers
604 views

How do I add and display a custom image field to a category? [duplicate]

How do I add and display a custom image field to a category? I know I need to use the hook 'category_add_form_fields' however I am not quite sure how... I am relatively new to wordpress so any help ...
0
votes
0answers
40 views

Show posts in numeric price order using meta query combining 2 meta keys

I've built a custom estate agency website for a client but I'm stuck on this one last thing before it's good to launch. I'm using custom meta fields to allow for additional meta data such as Price, ...
0
votes
2answers
627 views

How to exclude custom fields from search queries?

I'm building a hotel search engine and I've first created a custom content type "hotel" with Types & Views Toolset. I'm using "Search everything" plugin to query custom fields and custom taxonomy ...
0
votes
1answer
72 views

Querying posts with meta key and meta value not returning anything

I'm trying to create a query returning pages with a certain meta value. Only using meta_key works, it just doesn't work when I use both meta_key and meta_value. I know the meta_value is correct - I ...
0
votes
1answer
40 views

Order a WP_Query by meta value where the value is an array

I have a WordPress custom query: $args = array( 'posts_per_page' => 2, 'meta_key' => 'pworks_popular_posts', 'paged' => $page_nr ); $query = new WP_Query($args); ...
0
votes
0answers
21 views

Create meta boxes globally

I am trying to create a smallish plugin for my needs where I can be able to add some information about people only visible to back-end - I don't want to have it like a post visible to public, and ...
1
vote
0answers
168 views

How to add custom field to custom taxonomy in 4.4

I have a custom taxonomy for cities, and would like to have this available as a custom field to be able to access it using the iOS Workflow app. Considering the changes in 4.4 what should I do if I ...
0
votes
2answers
4k views

How to display all custom fields associated with a post type?

What is the best way to display/dump all custom fields associated with a post? It doesn't have to be pretty, I just need to verify what is being saved in what field array for debugging.
3
votes
2answers
111 views

Is there a hook / action that is triggered when adding or removing a post thumbnail?

I'm trying to update a custom field after a post thumbnail (Featured Image) is either added or removed from a post. The aim of this is to keep track of whether a featured image has been added or ...
0
votes
1answer
36 views

Editor / Add Media: Is it possible to only allow galleries?

I am writing a theme for a client where the employees sometimes have trouble using Wordpress correctly. I am using custom fields to let them add a gallery to a portfolio item (which is just a custom ...
0
votes
1answer
767 views

Adding Custom Fields to Search

I'm trying to add custom fields to my search so that it can be refined by meta values. Currently I have added some select lists to my normal search: <form role="search" action="<?php echo ...
0
votes
1answer
32 views

Cross reference custom post types

Just curious if can I autopopulate custom post fields (like checkboxes or select items) based on another custom posts setup? My goal is to create a custom post types "employees" which can have ...
0
votes
2answers
127 views

When editing a post with a custom meta box the values aren't displaying correctly

I followed this tutorial to create a custom meta box with a simple two option drop down. My code is below. The custom fields are saved when creating a post, and edit when I change the value and ...
0
votes
0answers
85 views

Help sorting by Meta Key value

using this https://github.com/growthspark/wp-advanced-search I am not sure how to sort by meta_key value. I currently have a meta key called "Due Date" with the date entered like 06/06/2012 (M/D/Y). ...
0
votes
1answer
1k views

Order by custom field date?

I've created a category "Expire Soon" and i want to insert and sort the posts by custom field "expiration_date". I use this code but the posts are sorted by custom field "expiration_date" but not by ...