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

learn more… | top users | synonyms (2)

3
votes
1answer
3k views

Custom Taxonomy Template Post List with Sort Order

I have an interesting problem I am trying to solve. Here is my situations: I have create a custom post type for "events". For each event post I require custom fields to be entered for the event ...
3
votes
4answers
3k views

How do I make a custom field choose an image?

I need a way to create a custom field that will let me pick an image from the media gallery. How do I do that? The custom field should have a button that when clicked will take me to the media ...
3
votes
1answer
955 views

Auto sort the wp-admin post list by a meta key

I am using this following code in my functions file to hide and add some custom columns to my post-edit screen in wp-admin. I am now trying to get the post list to sort by a post meta field (last ...
3
votes
1answer
315 views

Custom fields PHP foreach loop

In my theme, I am using some PHP to display custom field content. It checks if the fields are empty before displaying the content, because the_meta was showing titles for empty fields. <div ...
3
votes
2answers
3k views

Retrieving custom fields with $wpdb->get_results

I'm trying to use $wpdb->get_results to retrieve an array of all posts including custom fields. I can retrieve the meta_key and meta_value columns like this: [meta_key] => state [meta_value] ...
3
votes
1answer
3k views

Meta Query with AND & OR?

I'm trying to do some filtering for some posts in WP_Query, but I can't seem to get the right condition. Basically what I wanna do, is get posts that have the custom field event_data (sorted by this ...
3
votes
3answers
2k views

How do I order by multiple custom fields using wp_query?

I have a rating system where the user can enter a custom field of either "Stars" or "Hearts", but whichever one they choose they have to enter a value of 1 thru 5. Using wp_query, I can successfully ...
3
votes
2answers
2k views

Archive sorting functions by custom fields (front-end)

I want to give the users the ability to sort the posts in the archive by some custom fields that I pre-define. The end result would be en a tabbed container, and the user will click on the relevant ...
3
votes
2answers
342 views

Is it possible to define the data type of a Custom Field?

I am adding a new "Custom Post Type" named "Seminar". I am defining three custom fields Location StartTime EndTime StartTime and EndTime are going to store dates (surprise, surprise). I am ...
3
votes
1answer
307 views

How to use multiple query with same meta key

I use these codes to print custom field query. My custom field key is out_wiki <?php if( get_post_meta($post->ID, "out_wiki", true) ): ?> <div class="outlink"> ...
3
votes
1answer
881 views

Formatting custom meta box date from YYYY/MM/DD to a more readable alternative

QUESTION This is following a previous question that was graciously answered by Milo earlier here - How to sort CPT by custom meta value (date), and return posts month by month In short, I'm having ...
3
votes
2answers
792 views

How can I save repeatable fields with one value inside an array?

Introduce I am currently working on a slider plugin to learn a lot of PHP and WordPress. I have create some repeatable field with javascript. Some functional details: When the user is clicking on ...
3
votes
1answer
291 views

Using get_post_meta with new_to_publish

I'm trying to read the custom fields set by the user when publishing a new post: function doSomething($post) { $meta = get_post_meta($post->ID); error_log("post meta: ".print_r($meta, ...
3
votes
2answers
346 views

How to set a default meta value for custom field

I have setup a custom meta_key for attachments. Since it is a radio button with Yes/No options, and the default value is always Yes, I need that this default value is saved into the db when the ...
3
votes
2answers
898 views

Custom metabox for menu administration page?

I've been googleing around but failed to find a solution for my need. I'm using wordpress 3.0 and TwentyEleven theme as default pack. In the Dashboard -> appearance->menus that allow user can ...
3
votes
2answers
366 views

How to add new custom page or post blocks?

I would like to add custom contents to post, such as price, options and some others, I dont like to use the custom fields, because always i have to select from a drop down menu, I want these options ...
3
votes
4answers
818 views

How I check if the same post slug has not been used before publishing?

For an indie rock agenda I created event posts. With the help of javascript, the custom fields values (bands, places and date info picked in select boxes) are copied as the post title when publishing ...
3
votes
1answer
835 views

Wordpress - custom fields are not restored to previous revisions

I have built several Wordpress websites and noticed that custom fields are not restored to previous revisions. This might cause a problem when using custom fields to store content. Anybody knows how ...
3
votes
1answer
1k views

importing data from non-wordpress mysql db

I have created an import file to get the articles from a non-wordpress db and bring them in as posts in wordpress, I am not sure how to bring over the thumbnail image into my custom field I defined as ...
3
votes
1answer
387 views

Custom Fields and performance

My question : how many custom fields or even taxonomies WordPress can handle without affecting performance? The reason I ask, is because I started building a custom theme and I might need to have ...
3
votes
1answer
193 views

Custom post type or just use custom fields

I am turning a restaurants website into a wordpress website to allow for the customer to take over content changes. The restaurant has a menu that has categories like Baskets with different types. For ...
3
votes
3answers
264 views

How can I avoid re-inventing the Custom Fields wheel in my Plugin's Metabox?

Here's the scenario: In my plugin, I want to have a metabox show up on the post / page editor. I want the metabox to be -exactly- like WordPress' 'Custom Fields' metabox, ( Add another, delete, ...
3
votes
1answer
821 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 ...
3
votes
2answers
456 views

checkbox in post add/edit to add/remove the post from menu

Introduction: I have created several post type for my theme. To display a post from a post-type I need to go in appearance/menu and then add the post manually. My Goal: I want to add two radio ...
3
votes
2answers
115 views

Query meta field using between

I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that. Let says I have these in the database Meta-key: lat Meta-value: 54.3415000 ...
3
votes
1answer
371 views

Edit Imported advanced Custom Fields from wordpress Dashboard

I have imported advanced custom fields from one of my other site and now I want to add few more options to those fields but I can't figure out how to do it via Dashboard? I have imported the field ...
3
votes
2answers
510 views

How to delete custom field “suggestions” from dropdown list

When you use a standard custom field in WP you have to write the name of the cusotm fields the first time. The second time you use a custom field it sticks to the custom fields dropdown list. But, ...
3
votes
1answer
221 views

Storing meta fields multiple times OR once with multi dimensional array?

I got some options that I expand using a repeater type field. The values I save for each field is already an array so in essence I'm saving a multi dimentional array per option. (See this weekly ...
3
votes
1answer
77 views

Issue with saving custom post type when editor is removed

This one is doing my head in! I'm using this code as the basis for one of my custom post types. https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/blob/master/functions/real-estate.php ...
3
votes
2answers
220 views

Order Posts by Closest Numeric Values

I'm using custom post types to display properties and have a custom price field assigned to each post. On the property page I want to display a list of four similarly priced properties, two less than ...
3
votes
1answer
806 views

With WordPress Importer, why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?

The Question With WordPress Importer, why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks? Is there a workaround that I can do to ...
3
votes
1answer
225 views

Is there a way to do multiple ordering on a multiple meta_query?

I'm experimenting with searches and multiple criterias and ordering. Let's say we have a real estate site, all posts have 2 custom fields (price and surface), and we want the visitor to be able to ...
3
votes
1answer
2k views

Querying custom post type with 2 custom fields (date-range)

I've searched WP Codex and StackExchange and gotten some clues, but I can't get this query working. I have 2 custom fields associated with each exhibition in Y-m-d format: exstart-date being the start ...
3
votes
1answer
187 views

Using wordpress post data as input for google visualisations

I'm trying to use wordpress post data (eg title, link, custom fields) as a data source for google visualisations. I want to be able to take the wordpress data for all posts and visualise using the ...
3
votes
1answer
419 views

Utilize TinyMCE hyperlink chooser outside of TinyMCE

Is it possible to use the "Insert/edit link" dialog box outside of TinyMCE? For example, if I wanted to add that dialog box to a generic button within a plugin settings form, is it possible to ...
3
votes
2answers
1k views

adding custom fields to next and previous post link

Im trying to make my next and previous post buttons display my custom field but for some reason it doesnt display the custom field its just blank. Heres my code. <div id="next-prev-links"> ...
3
votes
1answer
275 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 ...
3
votes
1answer
2k views

add_meta_box: Datepicker like the one for postdate?

I've built a custom post type called "Events". Each event has a future date and I don't want to use the normal postdate of the post. I want to use add_meta_box to add some inputs for this ...
2
votes
3answers
923 views

Save page data to an xml file

Is it possible to continually update an xml file on the server with data from a wordpress page? If so, how could I do it? I use this plugin http://plugins.elliotcondon.com/advanced-custom-fields/ to ...
2
votes
3answers
7k views

Add a Jquery Datepicker to custom field in post edit

I would like to add a custom field that is set by a jquery datepicker ui in the post edit panel. Im new to wordpress, so Im not sure how to go about adding something like this. I haven't had much luck ...
2
votes
2answers
160 views

How do I read the value of a custom field of the page?

When creating custom page templates, how do I get the value of a custom field of the displayed page?
2
votes
3answers
1k views

Metabox nonce PHP notice

I've been getting a notice when I try to add a new post in two different taxonomies, in one i use a custom meta box and in the other not, however the notice appears for both when trying to add a new ...
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
3k 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
510 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
1answer
661 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); ...
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
5k 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 ...