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

learn more… | top users | synonyms (2)

4
votes
4answers
1k views

add meta box - custom field : which to choose?

i've just find out about the custom field, which makes it possible to add something near a post, but what is the difference between "add_meta_box" and "custom field"? Custom field is inside the ...
4
votes
3answers
793 views

Sort posts by custom field numeric value using dropdown

I've read umpteen answers and questions about things that are very similar to this but I just can't get it to work for my specific situation. I have some posts with a category of "property". In ...
4
votes
3answers
1k views

clients list using wordpress

I am using wordpress for my new website and i have list of clients(name and their logos). I am confused how to make those editable using wordpress? Html as follows... <ul> <li><img ...
4
votes
5answers
5k views

Adding Custom Field to Taxonomy Input :Panel

I am looking to achieve something which I figured would be fairly simple to accomplish but it seems there are no real examples available to achieve my needs. Essentially I have a custom post type of ...
4
votes
1answer
514 views

What is the index [0] for on post meta fields?

Trying to improve my PHP knowledge through test and try! I am confused on [0] arguments at following WordPress PHP code global $post; $custom = get_post_custom($post->ID); $price = ...
4
votes
3answers
13k 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 ...
4
votes
2answers
3k views

Most efficient way to add javascript file to specific post and/or pages?

I am wondering what the most efficient method is to add a javascript file specifically for a post and/or page. Here are a few solutions I came up with: Switch to HTML editing view and post your ...
4
votes
4answers
6k views

Sorting a query by custom field date

EDIT: Reworded the question for more clarity I'm trying to sort by custom meta box data, which I am converting to a date using the strtotime function, but I'm having some difficulty. My chief ...
4
votes
2answers
10k views

Filter WP_Query for posts having a certain meta-value

How to filter WP_Query for posts having a certain meta-value, without using a Custom Select Query? I have a custom posttype with meta-key: "open", and meta-value options: "yes" or "no". I would like ...
4
votes
4answers
6k views

I want to have my custom field use HTML, how do I do that?

I want to have my custom field use HTML, how do I do that in such a way that I can use a rich text editor to view the content?
4
votes
2answers
4k views

How to validate custom fields in custom post type?

I wrote a plugin that creates a custom post type with custom fields. To prevent users from entering incorrect information, how can I validate the data? I assumed that the save_post hook function ...
4
votes
4answers
3k views

meta_query for keys that aren't yet set

I'm trying to query for a custom post type for a gallery system. I have a checkbox to set a gallery as a "featured" gallery (set up through More Fields plugin) - if this is checked then the meta value ...
4
votes
1answer
3k views

Search multiple custom fields by using meta_query

I'm trying to create a search results listing for a custom post type and the problem I'm running in to is with the way the 'meta_query' parameter is stringing the passed values together. It appears ...
4
votes
3answers
9k views

Filter by one custom field, order by another?

I have a custom post type "Listing" and I want to get all Listings that have a custom field gateway_value != 'Yes', and order the results by another custom field, location_level1_value. I can get the ...
4
votes
4answers
6k views

Add custom taxonomy fields when creating a new taxonomy

I've been able to leverage this super tutorial by @Bainternet in order to add custom fields for taxonomies. I've tweaked the markup, and added a separate callback to add fields to the "Add New ...
4
votes
1answer
86 views

compare meta_query in get_posts arguments

I like to exclude certain posts with a custom field. So if my_custom_field_ignore isset AND 1 ignore this post. If it's not set include it. This is what I have $args = array( 'post_type' ...
4
votes
1answer
297 views

Adding another state (spam, reject, approve) to wordpress comments?

i know this might sound a bit weird, but what I'm trying to do is rather simple in mind but may be technically difficult. I'm running small contests on my wordpress site where I ask users to leave a ...
4
votes
1answer
539 views

Move from old custom field to new post_thumbnails

I've just taken over a busy WordPress site that's got ~800 posts so far. The site's been around long enough that it was started up before post_thumbnails was available. They worked around that ...
4
votes
2answers
150 views

Make Custom Field Into A Link On The Front End?

I have set some custom field 'artist' and 'song-name' displaying like: Artist: <user input> Song Name: <user input> My question, how do you make the on artist and song name into a ...
4
votes
1answer
2k views

How to order adjacent posts (prev / next) by custom field value?

I am using the More Fields and More Types plugins to create a custom post type called product. This custom type is based on the Post type. One of the fields is named lot which is an integer ...
4
votes
1answer
4k views

How to filter custom posts by tags and custom fields?

I'm planning a site for a client who wants users to be able to filter upcoming events by the following criteria: Type i.e. Comedy, Theatre, Music etc. Date Daily or Weekend Duration Daily or Half ...
4
votes
1answer
1k views

Using Custom Fields in Custom Post Type URL

I'm developing a car site that has showrooms. Each showroom needs it's own custom URL based on it's location. The location (City and County/State) is already inserted as two custom fields. So for ...
4
votes
1answer
355 views

update_user_meta: How many is too many?

I am working on a community portal that may in future cater to extremely large user base. All users have about 50 settings that needs to be stored to the user meta. These settings would be frequently ...
4
votes
1answer
863 views

Show links to archive pages based on custom field values

I have a recruitment website on which I want to display a list of Job Location links. The job location has already been entered into a custom field for each post so I just want to display a list of ...
4
votes
3answers
659 views

Query custom post type by custom field

General Info I used the plugin WP Types (wp-types.com) to create a custom post type called "artist". In WP Types you can also set another post type as parent post type. This is not possible by ...
4
votes
1answer
389 views

What is the advantage of the wp_options design pattern?

As we all know, a design pattern that is used frequently in Wordpress' DB code is the idea of persisting data for a particular object (blog/post/comment), indexed with a particular name or key. We ...
4
votes
1answer
242 views

Hide custom post type field from author?

For a business association website, I've built a membership database using a custom post type. Businesses sign up with an online form, which creates a custom post for that business, and when the ...
4
votes
1answer
4k views

Creating Photo Gallery System with Custom Post Type

I'm creating a movie blog using WordPress. I have Movie and Trailer custom post types and I want to add a Photo feature for this and I want to add a relationship between this photos and Movie CPT. ...
4
votes
1answer
565 views

explode array within shortcode

This functions at the moment but it only returns the first value from the array. I've been struggling to echo, print, explode, or whatever the multiple custom field values that share the same key ...
4
votes
1answer
444 views

Unable to get Preview of Uploaded image within a Custom Meta box

I first followed the steps in this tutorial. Added the Image Uploader, tried it out but I realized it's an older version of the WP Uploader... So I then found this post, and now my uploader is ...
4
votes
3answers
3k views

Using meta query ('meta_query') with a search query ('s')

Trying to build a search that not only searches the defaults (title, content etc) but also a specific custom field. My current query: $args = array( 'post_type' => 'post', 's' => $query, ...
4
votes
1answer
1k views

Update all posts automatically when using post_meta

I recently created a new site using wordpress but I'm a rookie - everything I know is trial and error with no formal training. So please, please, please keep your answers as simple as possible. Thanks ...
4
votes
1answer
1k views

How to filter custom post type archive by meta value

I have a problem where I'm trying to build a calendar plugin for a client. I'm having trouble getting a date based archive for the custom post type I'm using. I'm not too well versed in how the ...
4
votes
1answer
108 views

Allow user to create instances of custom field

I have a custom field for a links page which takes a name and an URL and saves it in the post meta. However, I want the user to be able to click "Add new link" and a new custom box appears so they can ...
4
votes
2answers
815 views

Add custom fields within meta box class “on the fly”

I'm one of the contributors for the Meta Box Class here on Github (link) and before I get too deep, I wanted to ask if anyone knew of a straight forward way to allow users to add additional fields "on ...
4
votes
2answers
1k views

Using media-upload.php to upload mp3 via custom fields

I'm trying to use the Thickbox file upload dialogue with a custom field to allow the user to upload an mp3. What I want to do is to grab the URL of the uploaded mp3 and save it as postmeta (saving the ...
4
votes
1answer
187 views

Prevent reload confirmation after AJAX save

I am saving information in the admin panel via ajax. The problem I'm running in to is the "Are you sure you want to navigate away from this page" popup appear, even though everything has been saved. ...
3
votes
3answers
2k views

SELECT max(meta_value) FROM wp_postmeta WHERE meta_key='price'… stops working when value is over 999

Overview: I am not trying to return a post. I simply want the single highest value for a particular meta_value across all posts... just the value itself. Details: I have added a custom meta_key ...
3
votes
3answers
3k views

Do_Shortcode not working for Embed

I'm trying to use Custom Field types to embed Youtube videos in a more organized fashion and using the Do_Shortcode() would seem to work perfectly, however this: <?php echo ...
3
votes
2answers
8k views

Convert jQuery Datepicker Format to SQL Date Format

I set the jQuery Datepicker format to D d.m. displayed as Th 3.3. for a custom meta field that I want to use to sort posts. In SQL, the custom meta field is saved as D d.m. I would like to display ...
3
votes
1answer
5k views

How can I add extra attribute in the 'Page Attribute' section in wp-admin for pages?

I would like to add a select list in the Page Attribute box you see on the right side in the administration interface for pages. Does anyone know if that is possible? Or at least add a custom box ...
3
votes
1answer
705 views

Truncating custom fields

I'm using custom fields to pull a secondary description. I'd like to use the built in WordPress truncate but can't seem to figure it out. $desc = get_post_meta($post->ID, "youtube-desc", true); ...
3
votes
2answers
2k views

How do I paginate search results for custom post types?

I have a Custom Post Type called "cars" that stores several custom fields along with the standard Title/Description fields. I need users to be able to search through the CPT based on the custom fields ...
3
votes
3answers
3k views

Add new “Insert Into Post” button with another function

Problem: Add a hook that automatically adds a short tag to video attachments when inserted from the Media Library (video) tab: Update: This works under the 'Media Library' tab — and doesn't break ...
3
votes
4answers
4k views

Custom per-page sidebar widgets .. possible?

Let's say I'm doing a site about cars, and in the main content area of a Page (using a certain template), there are a few paragraphs about a particular car. In the sidebar, are several standard ...
3
votes
2answers
4k views

Can I exclude a post by meta key using pre_get_posts function?

I see many people prefer to use pre_get_posts hook instead of query_posts. The code below works and shows all posts which have meta key "featured" function featured_posts( $query ) { if ( ...
3
votes
3answers
3k views

Add custom option to Standard Page Attributes Meta Box

I'd like to add a simple checkbox option to the exsisting standard Page Attributes Meta Box. Is there an obvious/intended way to do that using the WordPress API, rather than registering a new ...
3
votes
1answer
749 views

How can I change the admin search posts fields?

I have a custom post type that includes many custom fields. I would like to add them as a search target to admin search. Currently the admin search searches only the content and the title, I would ...
3
votes
1answer
860 views

Adding meta values to permalink

I have publications and I want to simply add year and month to the permalink. Currently the year and month of publication is added to the post as a meta value. I've set up publications as a custom ...
3
votes
1answer
263 views

Adding Custom Fields for Img in Posts

I'm wondering how I'd be able to set a custom field within my Wordpress posts. I want to have a field available to add an image via the Post dashboard - that has a max width & max height set, I ...