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

learn more… | top users | synonyms (2)

2
votes
2answers
6k views

How to activate “custom fields” section in WP3

This is probably a stupid question, but I am setting up a finnish Wordpress installation. The "custom fields" section in the "write post" section is gone; I gather it is hidden by default. That is a ...
2
votes
2answers
4k views

Add a checkbox to post screen that adds a class to the title

I'm needing some posts to have different title colors than others, and I figured this would be most conveniently accomplished by some sort of check box on the post creation/edit screen. How would I go ...
2
votes
4answers
3k views

Order posts by custom field and if custom field is empty return remaining posts

I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field. $paged = ...
2
votes
3answers
516 views

Custom post type / custom fields

I'm working on a client site and need the following: A custom post type called 'Agreements' On the Agreements edit panel, show a list of "Offices" checkboxes. Users can select multiple Offices per ...
2
votes
2answers
70 views

Can wp_query return posts meta in a single request?

I would like to create a wp_query that would return posts meta inside the posts array. $args = array ( 'post_type' => 'page', 'meta_key' => 'someMetaKeyName', ); // The Query $query = ...
2
votes
2answers
3k views

Add subtitle to Woocommerce product title

I'm using WooCommerce on a site built with Pagelines Framework. I need to have a subtitle/customisable field appear under the product name anywhere it appears in the site. As it is, WooCommerce ...
2
votes
1answer
1k views

Check before publishing, if already exist post with current custom field value

I have a custom post type with only 3 custom fields in it. $post_types = get_post_meta($post->ID,'post_types',true); $post_taxonomies = get_post_meta($post->ID,'post_taxonomies',true); ...
2
votes
3answers
6k views

Return all custom meta data for one custom post type

I've set up a custom post type which has three custom meta fields: name, latitude, longitude. Each post already shows the name on an integrated map based on it's latitude and longitude. I now would ...
2
votes
2answers
1k views

How to rename a custom field?

I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. Question 1 I am ...
2
votes
1answer
1k views

The “_encloseme” Meta-Key Conundrum

While working with metaboxes / custom fields I've seemed to indirectly create many of these _encloseme meta_keys all over my wp_postmeta. Seen here: So far no problems have arisen from this and ...
2
votes
1answer
312 views

template_redirect for single posts w/ custom fields

Is there any way I can use is_single() inside of my plugin's functions.php file? Currently, this is what my code looks like: if(is_single()) : function my_template() { include(PLUGINDIR . ...
2
votes
4answers
1k views

Custom field values repeating

I'm at a loss. I've got a custom meta box with the 'multicheck' code that Jan created. It's working great. My issue now is getting the data to return properly. Scenario: there are 5 possible values, ...
2
votes
3answers
9k views

How to use query_posts() with a date filter on a custom field?

I have defined a custom post type that uses a meta field to store dates. In my functions.php I have the following code which saves the start date. The format of the date that is sent in the startdate ...
2
votes
2answers
61 views

Custom post meta field effect on the performance on the post

I have the posts which have many custom defined meta fields. On posts I am calling them on requirement using get_post_meta. Means for 10 meta fields I am using it 10 times. Am I doing it right? ...
2
votes
2answers
268 views

Custom field losing p tags on display

I have a Custom Post Type that has several custom fields. One of the fields is multi-line and includes text with p tags. When I view this field in the visual editor the p tags are all there. I ...
2
votes
3answers
1k views

Advanced Custom Fields - Get custom fields from parent page

I'm using Advanced Custom Fields making it easier for my client to manage his content. On all of my child- and parent pages i would like to have the same header image and sidebar information. ...
2
votes
2answers
854 views

Show posts on a Google Map

Through the custom fields, I assigned to each post its geographic coordinates (latitude/longitude). Now, I'd like to show a Google Maps with a marker for each post. Do you have any suggestions on ...
2
votes
3answers
2k views

Add input field to 'Pages > Edit Page' through functions.php

Original Question: I'm trying to add an input field to 'Pages > Edit Page'. The use of this input field will be for a user to add an ID of a slider, so that that slider will be page specific. ...
2
votes
2answers
933 views

Multiple custom fields with the same name

Is it possible to have several custom fields with the same name? For example, I have a custom field called "promotion" for a CPT called "event". Sometimes there are more than one promotion applied ...
2
votes
1answer
1k views

How to sort CPT by custom meta value (date), and return posts month by month

For future reference: I am using the great Meta Box Plugin to help expedite meta box creation for my custom post types. My goal: To build a highly customizable events section closely resembling a ...
2
votes
1answer
1k views

Saving Custom Field in Attachment Window in WordPress 3.5

I'm using the code below to add a custom text field in WP 3.5 Attachment Window (from this question # Expanding new Media Uploader in WordPress 3.5) ... add_filter( 'attachment_fields_to_edit', ...
2
votes
1answer
3k views

Add custom fields when specific templates are selected

I'm trying to make change to a site where with the current infrastructure isn't great as due to how it's been built over the previous site rather then fresh. I have a section of the site which needs ...
2
votes
2answers
621 views

Is it possible to order posts by two meta values?

Hopefully this is a reasonably straightforward question! Is it possible to order posts, on the front-end of my WP install, by two meta values? I have a meta key called genus and another called ...
2
votes
1answer
719 views

Many to Many Relationship between Two Custom Post Types

How to I create a many-to-many relationship between two custom post types? Give type A and type B, I'd like to be able to show all B's that relate to a given A, and all A's that relate to a given B. ...
2
votes
2answers
3k views

Edit Custom Database Tables in Wordpress

I have a site that uses custom database tables to manage info that is inserted by a process completely independent from Wordpress. The data from the table is used in the Wordpress site but it is not ...
2
votes
1answer
505 views

How to prevent custom fields from being cleared during a bulk edit?

In my function for saving custom field values I add a few checks to prevent the values from being cleared during an autosave or a quick edit. add_action('save_post', 'save_my_post'); function ...
2
votes
2answers
3k views

How do I add media to a custom post type?

I want to add some custom fields to allow a user to select items from the Media library for the custom post (in the add/edit view) Is there a way to do this?
2
votes
1answer
2k views

I am trying to create a simple frontend form for posting

i am trying to learn and create some deeper things with Wordpress. My goal is to create a code/script/plugin that will allow me to post from the frontend. I have seen many plugins, like templatic ...
2
votes
1answer
1k views

custom field value date convert to unix timestamp problems

For some reason, I'm having difficulty converting a date value stored in a meta field to a unix timestamp (and back again). If I save the date as a string it all works fine, but if I convert it to a ...
2
votes
2answers
2k views

How to change what the post creation page looks like?

Is there a way (plugin, or something else) to set it where there is a drop down on the "New Post" page that allows you to choose a post type and the fields change allowing you to filter what content ...
2
votes
4answers
208 views

Multiple information using custom post type

I made a new custom type, it's working fine. My question is: If i want to add in a single post that custom-type with different informations for about x times...how should I do this? Example: Let's ...
2
votes
1answer
722 views

Advice needed for importing custom field data and database structure

Looking for advice for the best method to accomplish the following. I have a custom page template with several custom fields/taxonomy. The data needed for these custom fields actually resides in ...
2
votes
1answer
150 views

Meta query with string starting like pattern

I have a custom WP_Query with the following meta_query: $meta_query = array(); $meta_query['relation'] = 'AND'; if(!empty($postcode)) { $meta_query[] = array( 'key' => 'postcode', ...
2
votes
1answer
229 views

Custom Field sort not working (WP 3.8.1)

I am trying to sort a custom wp_query using the date format YYYYMMDD (php: date('Ymd') ). This will not be regarded as date field, but rather as a numeric one stored in custom field. My WP-QUERY code ...
2
votes
1answer
240 views

Automatically assign taxonomy term if custom meta value exists

I currently have a custom meta field for adding a video url to the post. I'd like for the existing taxonomy term "video" to be automatically assigned to the post upon saving if the meta field has any ...
2
votes
1answer
232 views

Add description text under input field for new profile fields

How can I modify my following code to add some description text under the input fields? I tried modifying it as you can see with the facebook url field but the text shows up under the field label and ...
2
votes
1answer
87 views

Why is unfiltered html allowed in custom fields for author / contributor roles?

I'm creating a WordPress theme which has a custom textarea metabox for inserting embed codes (soundcloud, bandcamp etc). I feel like I should be adding in some security to stop non-admin/editor users ...
2
votes
3answers
47 views

Custom fields: In what order are they saved into the DB?

If I insert multiple custom fields to my article, they get sorted in "I don't know what" way. So when I insert some multiple fields in an article and call those via $cf = get_post_custom(); foreach ...
2
votes
3answers
440 views

Function to change meta value in database for each post

I have a meta key called 'prijs' in each post. The value of this meta key consist of numbers in the follow structure: 2,100.00 I want to remove the comma in the meta value to get this output: 2100.00 ...
2
votes
2answers
3k views

Populating meta box with select-list of existing posts, and assigning it to custom post types

My question is partly based on this answer: http://wordpress.stackexchange.com/a/5778/27135 Mike's answer is really great, and the solution worked fine until I needed to include my meta box in a ...
2
votes
1answer
2k views

Advanced Custom Fields query

I have, hopefully easy question. I have my query here, which is using ACF <?php query_posts(array('post_type' => 'our-clients-list', 'posts_per_page' => 1, 'order' => 'DSC', 'orderby' ...
2
votes
1answer
175 views

Adding a custom field or metabox to the post-thumbnail widget?

Is it possible to add a custom field to an existing "widget" in the backend? What I wanna do is provide a way to have a checkbox to apply a thumbnail that is double the size of the normal one on the ...
2
votes
1answer
269 views

WP doesn't show Array Custom Fields?

I'm wondering why WordPress doesn't list PHP array() and any serialized data in Custom Fields in Admin Panel (for Pages, Posts etc.)? Only Custom Fields containing strings and numbers show up and can ...
2
votes
1answer
3k views

Multiple orderby values in WP_Query

I'm trying to come up with a query to sort by multiple orderby values. Here's what I have so far: $dept_id=2; $query=new WP_Query(array( 'post_type'=>'wpcontactus', ...
2
votes
1answer
2k views

passing argument to get_template_part() or a better way to code

I have this include … event-list.php <?php /** * The loop that displays upcoming events */ ?> <ul class="event-items"> <?php $yesterday = time() - 24*60*60; $args = array( ...
2
votes
1answer
268 views

Create meta boxes that don't show in custom fields

I used the code below to create a metabox for posts. These meta boxes are also seen in the custom fields. I do not want these meta boxes to show in custom fields. Is there any way to not show meta ...
2
votes
1answer
3k views

Using custom field as custom post title

I've setup a custom post type with a series of custom fields using the WPAlchemy class. I'm trying to take the value of one of the custom fields and use that as the post title. So far, though, I've ...
2
votes
2answers
1k views

Auto-add paragraphs to custom field?

hey guys, is it possible to format text in a custom field input box automatically with paragraphs? e.g. like the normal text-widget that has the option to say "auto-add paragraphs" when there is a ...
2
votes
4answers
2k views

Automatically Insert Custom Field on Custom Post Type Publish

I was searching for a way to automatically insert a custom field when publishing a custom post type. And I repeatedly found the same solution, from here: ...
2
votes
2answers
1k views

Correct Approach for Validating Custom Field Input

I have a custom post type with several custom fields. I am looking to do some validation on these fields because they will be used downstream by other services. So, it is important that it can't be ...