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

learn more… | top users | synonyms (2)

3
votes
2answers
2k views

Problem with serialized arrays in custom meta

I've recently moved my fishkeeping "species profiles" over from a custom DB to a customised WordPress custom post type. I did this by creating a PHP file which accessed the former database, extracted ...
3
votes
5answers
576 views

How to do a custom bookmarks post type?

Let me first explain what I am wanting to do... I am wanting to add all my hundreds of website bookmarks that I have now in my browser, into wordpress for the following reasons. Can search my ...
3
votes
1answer
495 views

Meta keywords and descriptions plugin for manually editing meta for each page/post

Can anyone recommend a simple plugin that allows me to add/edit meta tags for keywords and description on each page of my wordpress site? Just something that adds the fields to the page editor would ...
3
votes
3answers
2k views

querying with custom meta field with meta_query

How do we get posts where the meta key does not exist in a post. I have created a meta_key video. and i want to be able to get some posts with WP_Query where custom field video does not exist or is ...
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
1k 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
365 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
2answers
7k views

Show values of custom field created with ACF on a page

Im using ACF to create custom fields. One of them is a list of checkboxes that display some options (option1, option2, option3....). and what i need is to show these options on a page in a list like ...
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
348 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
101 views

Order by meta_value_num DESC and meta_value ASC on WP 4.0

I have created a custom post type that I want to order by custom-field-1, which is boolean so its value is either 1 or 0, in DESC order (1 to 0) custom-field-2, which contains text and is supposed ...
3
votes
1answer
386 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
1k 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
875 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
312 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
383 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
939 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
370 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
2answers
1k views

Custom field values deleted when trashing custom post type

I've created a custom post type with 2 custom fields attached to it... When I create a post of this type and fill in the custom fields, the data is, in fact, saved to the db... However, if I trash one ...
3
votes
4answers
843 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
868 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
423 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
265 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
2answers
502 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
119 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
423 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
584 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
247 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
79 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
229 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
881 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
227 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
188 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
2answers
9k views

Including custom fields in search?

I use custom fields for lots of my content on both Posts and Pages, so that half of the text will be in the main post body and the other half in a custom field. Unfortunately, when doing this only ...
3
votes
1answer
427 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
293 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 ...
3
votes
2answers
4k views

Show Custom Fields in Quick Edit

I have several custom fields that I need my client to be able to edit at anytime. For the sake of convenience, I'd like them to be able to edit these custom fields from the Quick Edit. This way they ...
2
votes
3answers
993 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
162 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
2k 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 ...