{"id":52,"date":"2026-04-27T20:15:55","date_gmt":"2026-04-27T20:15:55","guid":{"rendered":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/2026\/04\/27\/custom-fields\/"},"modified":"2026-04-27T20:15:55","modified_gmt":"2026-04-27T20:15:55","slug":"custom-fields","status":"publish","type":"post","link":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/2026\/04\/27\/custom-fields\/","title":{"rendered":"Custom Fields"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Custom Fields <em>[Pro]<\/em><\/h1>\n\n\n<p>Custom fields are category-specific listing details \u2014 make\/model\/year for cars, bedrooms\/bathrooms\/sqft for property, salary\/employment-type for jobs.<\/p>\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Pro feature.<\/strong> The free theme uses standard WordPress custom fields (<code>_bc_price<\/code>, <code>_bc_location<\/code> etc.) but doesn&#8217;t render category-specific UI for them.<\/p><\/blockquote>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Built-in field sets<\/h2>\n\n\n<p>Pro ships with three pre-configured field sets:<\/p>\n\n\n<h3 class=\"wp-block-heading\">Vehicles<\/h3>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Key<\/th>\n<th>Field<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>make<\/code><\/td>\n<td>Make<\/td>\n<td>text<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td><code>model<\/code><\/td>\n<td>Model<\/td>\n<td>text<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td><code>year<\/code><\/td>\n<td>Year<\/td>\n<td>number<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td><code>mileage<\/code><\/td>\n<td>Mileage<\/td>\n<td>number<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><code>transmission<\/code><\/td>\n<td>Transmission<\/td>\n<td>select (manual, auto)<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><code>fuel<\/code><\/td>\n<td>Fuel type<\/td>\n<td>select (petrol, diesel, electric, hybrid)<\/td>\n<td>No<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n\n<h3 class=\"wp-block-heading\">Property<\/h3>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Key<\/th>\n<th>Field<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>bedrooms<\/code><\/td>\n<td>Bedrooms<\/td>\n<td>number<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td><code>bathrooms<\/code><\/td>\n<td>Bathrooms<\/td>\n<td>number<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td><code>sqft<\/code><\/td>\n<td>Square footage<\/td>\n<td>number<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><code>rent_or_sale<\/code><\/td>\n<td>Rent or sale<\/td>\n<td>select (rent, sale)<\/td>\n<td>Yes<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n\n<h3 class=\"wp-block-heading\">Jobs<\/h3>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Key<\/th>\n<th>Field<\/th>\n<th>Type<\/th>\n<th>Required<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>salary<\/code><\/td>\n<td>Salary range<\/td>\n<td>text<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><code>employment<\/code><\/td>\n<td>Employment type<\/td>\n<td>select (full-time, part-time, contract, freelance)<\/td>\n<td>Yes<\/td>\n<\/tr>\n<tr>\n<td><code>experience<\/code><\/td>\n<td>Experience level<\/td>\n<td>select (entry, mid, senior, lead)<\/td>\n<td>No<\/td>\n<\/tr>\n<tr>\n<td><code>remote<\/code><\/td>\n<td>Remote?<\/td>\n<td>select (yes, no, hybrid)<\/td>\n<td>Yes<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">How fields are stored<\/h2>\n\n\n<p>Each field becomes a post meta with the prefix <code>_bc_field_{key}<\/code>. So <code>make<\/code> is stored as <code>_bc_field_make<\/code>. The full set is also stored as a serialized array under <code>_bc_custom_fields<\/code>.<\/p>\n\n\n<p>This dual-storage lets you query individual fields fast (<code>meta_query<\/code> works) AND get all fields with one DB call.<\/p>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Defining a new field set<\/h2>\n\n\n<p><strong>Classifieds Pro \u2192 Settings \u2192 Custom Fields \u2192 Add field set<\/strong>:<\/p>\n\n\n<ol class=\"wp-block-list\">\n<li>Pick the category this set applies to.<\/li>\n<li>Add fields one by one with: key, label, type, required, default, helper text.<\/li>\n<li>Choose if the field should appear in the listing&#8217;s sidebar info card on the frontend.<\/li>\n<li>Choose if the field should be filterable in search.<\/li>\n<li><strong>Save<\/strong>.<\/li>\n<\/ol>\n\n\n<p>The submission form picks up the new fields automatically when a user picks that category.<\/p>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Field types<\/h2>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Type<\/th>\n<th>UI<\/th>\n<th>Storage<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>text<\/code><\/td>\n<td>Text input<\/td>\n<td>string<\/td>\n<\/tr>\n<tr>\n<td><code>number<\/code><\/td>\n<td>Number input with step controls<\/td>\n<td>float<\/td>\n<\/tr>\n<tr>\n<td><code>select<\/code><\/td>\n<td>Dropdown<\/td>\n<td>string (the chosen value&#8217;s key)<\/td>\n<\/tr>\n<tr>\n<td><code>radio<\/code><\/td>\n<td>Radio group<\/td>\n<td>string<\/td>\n<\/tr>\n<tr>\n<td><code>checkbox<\/code><\/td>\n<td>Single checkbox<\/td>\n<td>&#8220;1&#8221; or &#8220;&#8221;<\/td>\n<\/tr>\n<tr>\n<td><code>multi-checkbox<\/code><\/td>\n<td>Group of checkboxes<\/td>\n<td>array (serialized)<\/td>\n<\/tr>\n<tr>\n<td><code>textarea<\/code><\/td>\n<td>Multi-line text<\/td>\n<td>string<\/td>\n<\/tr>\n<tr>\n<td><code>date<\/code><\/td>\n<td>Date picker<\/td>\n<td>YYYY-MM-DD string<\/td>\n<\/tr>\n<tr>\n<td><code>url<\/code><\/td>\n<td>URL input with validation<\/td>\n<td>string<\/td>\n<\/tr>\n<tr>\n<td><code>range<\/code><\/td>\n<td>Min\/max pair (e.g. price range)<\/td>\n<td>array of 2 floats<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Rendering custom fields on the frontend<\/h2>\n\n\n<p>By default Pro renders all custom fields in a definition list inside the listing sidebar. To hide a field:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>add_filter( &#039;best_classifieds_visible_custom_fields&#039;, function( $fields, $post_id ) {\n    unset( $fields[&#039;internal_notes&#039;] ); \/\/ never show\n    return $fields;\n}, 10, 2 );<\/code><\/pre>\n\n\n<p>To customize the rendering of a specific field:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>add_filter( &#039;best_classifieds_render_custom_field&#039;, function( $html, $key, $value, $field ) {\n    if ( &#039;mileage&#039; === $key &amp;&amp; $value ) {\n        return &#039;&lt;dt&gt;&#039; . esc_html( $field[&#039;label&#039;] ) . &#039;&lt;\/dt&gt;&lt;dd&gt;&#039;\n            . esc_html( number_format_i18n( $value ) . &#039; mi&#039; )\n            . &#039;&lt;\/dd&gt;&#039;;\n    }\n    return $html;\n}, 10, 4 );<\/code><\/pre>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Filterable fields in search<\/h2>\n\n\n<p>If a field is marked <strong>Filterable<\/strong>, it shows up in the category archive page&#8217;s filter bar. Visitors can refine listings by:<\/p>\n\n\n<ul class=\"wp-block-list\">\n<li>Make and Model (Vehicles archive)<\/li>\n<li>Bedrooms (Property archive)<\/li>\n<li>Salary range (Jobs archive)<\/li>\n<\/ul>\n\n\n<p>The filter UI is generated automatically from the field type:<\/p>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Field type<\/th>\n<th>Filter UI<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>select<\/code> \/ <code>radio<\/code><\/td>\n<td>Multi-select dropdown<\/td>\n<\/tr>\n<tr>\n<td><code>number<\/code> \/ <code>range<\/code><\/td>\n<td>Min\/max sliders<\/td>\n<\/tr>\n<tr>\n<td><code>checkbox<\/code><\/td>\n<td>Toggle<\/td>\n<\/tr>\n<tr>\n<td><code>date<\/code><\/td>\n<td>Date range picker<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Importing custom field data<\/h2>\n\n\n<p>If you&#8217;re migrating from another theme:<\/p>\n\n\n<pre class=\"wp-block-code\"><code># WP-CLI: bulk-set a custom field on all Vehicles listings\nwp post list --post_type=post --tax_term=vehicles --format=ids \n  | xargs -I {} wp post meta update {} _bc_field_make &#039;Honda&#039;<\/code><\/pre>\n\n\n<p>Or via SQL:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>INSERT INTO wp_postmeta (post_id, meta_key, meta_value)\nSELECT post_id, &#039;_bc_field_year&#039;, &#039;2020&#039;\nFROM wp_term_relationships tr\nJOIN wp_term_taxonomy tt USING (term_taxonomy_id)\nJOIN wp_terms t USING (term_id)\nWHERE t.slug = &#039;vehicles&#039;;<\/code><\/pre>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Custom fields don&#8217;t lock you in<\/h2>\n\n\n<p>All custom field data is in standard WordPress post meta \u2014 exportable via tools like WP All Export, accessible to other themes. If you migrate away from Best Classifieds, the data stays portable.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Custom fields are category-specific listing details \u2014 make\/model\/year for cars, bedrooms\/bathrooms\/sqft for property, salary\/employment-type for jobs.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-pro-features"],"_links":{"self":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":0,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}