Questions tagged [custom-field]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
3k views

How to show/hide php table rows based on the content of custom fields

I have a website that displays books information. I want to add Schema.org microdata markup to the posts containing books. I created a set of custom fields using the plugin called WP Types so I can ...
Atef Wagih's user avatar
0 votes
1 answer
150 views

Run str_replace on title and save the output to a custom field

I need to a make a custom RSS template for my website and I'm having problems getting substr(the_title_rss(), 0, strpos(the_title_rss(), ' —')); to work on the RSS feed. What the above code is ...
Gregory Schultz's user avatar
0 votes
1 answer
257 views

How to display custom fields from a plugin

I use a plugin, WooCommerce Simple Auctions. It has a list of custom fields, which I want to display their values. I got told by the support that I should use var_dump(), which I did, and it returned ...
Magnus Pilegaard's user avatar
0 votes
1 answer
1k views

pre_get_posts : only get posts by wp_usermeta value

I've added a meta field on my authors (company). How can I only display the posts written by authors with a specific company value (company1 or company2 for example)? I would like to do that within ...
superfive33's user avatar
0 votes
1 answer
2k views

create custom meta box with default value

I am creating a custom admin panel where the admin can choose between 3 layout using radio buttons. Everything works perfectly except when admin creates a new page there isn't default option. I ...
István's user avatar
  • 85
0 votes
1 answer
102 views

Singleton Custom Field (Meta Box)

How do I create a custom meta box for posts which have a boolean data type and can be true only for one post. I want it to be falsified for all other posts when it's set on one post. Is there a hook ...
Merhawi Fissehaye's user avatar
0 votes
1 answer
66 views

ACF in wordpress

Hi i have a slight problem when making a custom post type widget. The problem is that when i want to get the field i want to use in a inline style it doesn't work. This is my code: class ...
Dionoh's user avatar
  • 149
0 votes
3 answers
998 views

custom field (video/audio url) and embed functionality

I was wondering if there is any way to combine a custom field (in custom post type) with an embed shortcode? Long story short - a user type into a field called videox and an url for a video (youtube, ...
Julia Galden's user avatar
0 votes
1 answer
4k views

WP REST API - get custom taxonomies based on terms & filter

I need to get the list of data's with taxonomy term property_category,based on this property_category having data's like apartment,house,office etc.For example localhost url given http://192.168.0....
sankar muniyappa's user avatar
0 votes
1 answer
110 views

Display list of terms having the same custom field value

I have a custom field for my taxonomy called 'food_type'. How can I display a list of my terms where this custom field's value is set to "Cat food"?
Акрам Фаузи's user avatar
0 votes
1 answer
1k views

Problem with saving large amount of data in postmeta/usermeta

I am facing issues saving large amount of data in post meta field e.g. I have created a field Bio/description and put a huge amount of text in it. Now when I save it, it saves some of the text and ...
TBI Infotech's user avatar
0 votes
1 answer
9k views

How to display custom field in woocommerce email orders? [closed]

Am having trouble showing custom field data from a select drop down in the order email form in Woocommerce. The data is showing in the admin page order just not email? add_action( '...
Daniel Morton's user avatar
0 votes
1 answer
55 views

Custom meta is not being saved

I have created the following class in order to add a custom metabox for my posts, but the data is not being saved. Anybody can say what's wrong with my code? class Anotai_Meta_Box { public $...
Douglas de Moura's user avatar
0 votes
1 answer
1k views

How to make a customized user registration form using the built in wp-register() template tag

I want to make a registration form in WordPress, but i need it to contain my own custom input fields. For instance, i need it to have an input field such as COUNTRY, SCHOOL, COURSE, YEAR_OF_ADMISSION,...
femi jeffery's user avatar
0 votes
1 answer
3k views

Display post from a date range from custom field

I currently have a custom post type that has two major custom fields that are need for the query. The 'score_time' field stores time of a score. Example: 12:20 The 'score_date' stores the date the ...
Futaba Panda's user avatar
0 votes
1 answer
1k views

ORDER BY custom field value out of where clause

Based on example here https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/ I'd like to modify the query $q = new WP_Query( array( 'meta_query' => array(...
dkatwp's user avatar
  • 207
0 votes
2 answers
228 views

Link FROM attachment to full post and get custom fields values on attachment page?

This shouldn't be so hard! But I cannot find the answer to this question on Google.. How can I link from an attachment template to the full post please? Bonus question! How can I grab the custom ...
Algatella's user avatar
0 votes
1 answer
46 views

Editor / Add Media: Is it possible to only allow galleries?

I am writing a theme for a client where the employees sometimes have trouble using Wordpress correctly. I am using custom fields to let them add a gallery to a portfolio item (which is just a custom ...
Øle Bjarnstroem's user avatar
0 votes
3 answers
2k views

Allow only one post with specific meta value

I'm using a custom meta field, to specify which post will appear as a featured one in the front page. This meta field is a true/false value, declared through ACF. I want this condition to only be ...
Capiedge's user avatar
  • 778
0 votes
1 answer
2k views

List all unique custom field values?

I use this code to list unique values of custom field name "authors" from all posts. It works just fine, but I would like to limit results, to get values which appear in at least for example 20 posts? ...
Advanced SEO's user avatar
0 votes
4 answers
2k views

Get categories query not working in function.php

I am trying to get the categories of my custom post type in functions.php But it not return any value, when i run this query in any theme file it work fine. Here is my code function get_destinations()...
Aadil Afzal's user avatar
0 votes
2 answers
108 views

Display custom field value part by part?

I have custom field in posts called hex_colors which contains hex color codes separated with white space, custom field value is like this: "000000 f0f0f0 c0c0c0 202020 404040 " I can change function ...
Advanced SEO's user avatar
0 votes
1 answer
136 views

Custom Behavior when Adding New Custom Post Type in Dashboard

I have a Custom Post Type that I'm doing some custom work for. I want to attach some custom functionality to the post type once it's created but an admin can only trigger the custom action from the ...
Jacksonkr's user avatar
  • 357
0 votes
1 answer
3k views

Get all the posts where meta field with multiple choice has several values checked

I apologize beforehand for any confusion, I'm just 2 days with WP. So, I use Advanced Custom Fields to add formatable custom fields to posts of partucular type. One of fields is checkboxes with ...
folibis's user avatar
  • 103
0 votes
1 answer
4k views

wordpress custom loop ascending descending posts by custom field

I am developing wordpress site that is depend upon price so i add custom filed named 'price' <?php while ( have_posts() ) : the_post(); echo $price = get_post_meta($post->ID, 'price', TRUE); ...
moto g's user avatar
  • 1
0 votes
2 answers
2k views

Toggle custom fields?

I got a custom field and I want to toggle a specific custom field. So for example I have 2 custom fields named: Subject and Score. When viewing a single post the custom field 'Score' data is hidden ...
Ruriko's user avatar
  • 543
0 votes
1 answer
348 views

Iterate through users and display users meta info at front-page

I have a meta field in user called columnista-destacado I need to iterate through Wordpress users and if that field has valued set (lets said equal 1) then I need to display user meta info at front-...
ReynierPM's user avatar
  • 537
0 votes
1 answer
100 views

Warn user that data may be lost for custom pages

When you edit a builtin field in Wordpress like the title and don't save the cahnges, and attempt to go to another link, a warning alert box comes up stating that "changes may be lost if you navigate ....
Yahya Uddin's user avatar
0 votes
2 answers
900 views

How to display custom field value on page?

I have added custom fields by clicking on screen option and mark custom field ,how to display custom field value on page?
Nishtha Mahant's user avatar
0 votes
1 answer
131 views

get_post_custom stripping styling issue

I found this thread: Paragraphs removed when using get_post_custom()? Was hoping someone could either help me a little more though.. My code: <?php $post_customs = ...
Danny's user avatar
  • 112
0 votes
1 answer
900 views

Get post ID from a link

I will try to explain my issue as good as i can. Please take a look at the following page in my website. We have: The main page Inside the main page there is a "view offer" button The "view offer" ...
thundertrax's user avatar
0 votes
1 answer
383 views

post_per_page ignored in WP_Query

I have a custom post type named 'album' and I added two custom fields 'release_date' and 'release_date_us' with the ACF plugin. I'm trying to display the latest albums based in a widget area. The ...
cpuch's user avatar
  • 3
0 votes
2 answers
3k views

Add custom fields to existing posts (admin pages)

I'm able to add a custom field for new posts (in the admin pages), using the action hook wp_insert_post. But I would like to add the custom field for old posts, when I am editing the post (in the ...
eballo's user avatar
  • 191
0 votes
2 answers
594 views

Best filter to use for modifying custom fields on a post?

What is the best filter for editing custom fields on a post? I am not actually editing the post content but some related fields. Would it be add_filter('the_content', 'edit_custom_fields');? It just ...
Shawn's user avatar
  • 412
0 votes
1 answer
2k views

Order posts by date and then by custom field

I am trying to do something like this one. Ordering posts by day (not time) AND meta value I want to list blog posts ordered by date (not time) and then within that day, I want to sort them by custom ...
Robert hue's user avatar
  • 8,466
0 votes
1 answer
2k views

WP_Query Meta_key is text value and need to sort as numeric not working

I have the following code below in my ~WP_Query`. $args[ 'meta_key'] = 'price'; $args['orderby'] = 'meta_value meta_value_num'; $args['order'] = 'ASC'; The custom field in question has historic ...
user949509's user avatar
0 votes
2 answers
295 views

List of users that clicked a 'Join' button at single post

The title might be a bit vague while I'm not quite sure how to describe it. What I want: At every single post (in this case of post type 'event') a logged in user must be able to click a 'Join' ...
Trekdrop's user avatar
  • 245
0 votes
1 answer
59 views

Create a list of posts with topic headdings

I would like to use a custom field "topic" to order Wordpress posts. This seems quite doable using 'orderby' => 'meta_value', 'meta_key' => 'topic' But I would also like to have a ...
user3497301's user avatar
0 votes
2 answers
535 views

Multiple instances of TinyMCE are removing <p> tag

I'm using the following code in functions.php to add a TinyMCE box on custom field textareas inside the Editor: add_action('admin_print_footer_scripts','FT_TinymceCustom',99); function ...
user28216's user avatar
0 votes
1 answer
3k views

filter wp_query result with custom field values

I'm getting started with advanced custom fields. I have a category field (main_category) where the categories given below are selected using the radio buttons. 1. Electronics 2. Programming 3. ...
x0x's user avatar
  • 103
0 votes
1 answer
613 views

Order post type by sum of two custom fields

I have a custom post type for vouchers. I've added two custom fields to this post type named "value_1" and "value_2". They both contain a number. (The first value will be applied at checkout, the ...
Achim Baur's user avatar
0 votes
1 answer
11k views

Notice: Trying to get property of non-object in : custom fields category

I have custom fields in my category. I'm using this tutorial to add custom fields to my categories. I'm trying to output one of the custom fields on my category.php template but I'm unable to do so. ...
Ruriko's user avatar
  • 543
0 votes
1 answer
2k views

Hide custom metabox value from custom fields

Before I ask the question, I tried to added _ to the custom field, but it's not working, at least with my code. I just want to hide the value of my meta box from appearing in the custom fields. When ...
Hardeep Asrani's user avatar
0 votes
1 answer
653 views

Echo the custom field value from the latest post from the 'video' post format?

I am trying to create a 'latest video' section. Basically, what I'm trying to do is get the custom field value (video url) from the last post in the 'video' post format. Then, I'm trying to insert ...
Desi's user avatar
  • 1,209
0 votes
1 answer
215 views

How to remove custom fields from the selector?

I want to remove some of those: So the user doesn't use them by mistake, Any idea howto? ( maybe looking into the wp database? )
Toni Michel Caubet's user avatar
0 votes
1 answer
2k views

Can I use a Custom Field as the Featured Image URL?

Each post of my blog has a Custom Field which is the URL of a photo on Flickr. How can I use it as the Featured Image? Please note I'm asking this question because I'm migrating to a theme that makes ...
User's user avatar
  • 341
0 votes
1 answer
143 views

What is the proper way to add a required field to a post type? [duplicate]

So I created a CPT that has a few required fields in a metabox. My metadata is being saved through the save_post hook but from I can find via my googlefu there is no way to stop the saving of the post ...
Gazillion's user avatar
  • 317
0 votes
1 answer
2k views

3.8 Media Upload and Custom Meta Box

I've been using Tammy Hart's Reusable Custom MetaBox code for some time now but with the recent 3.8 update the media upload seems to be no longer functioning, and the code is no longer supported. ...
Picard102's user avatar
  • 933
0 votes
2 answers
134 views

Custom Field Multiple Clauses

I am having a weird situation, I have two meta keys in my custom posts. Start Date and End Date, In simple SQL, I want to execute following query where startDate > '2013-12-10' and (startDate <...
Niraj Chauhan's user avatar
0 votes
1 answer
535 views

delete_post_meta() for whole CPT / multiple posts?

I'm cleaning up a theme and one of Custom Post Types has some odd, long gone custom fields. I want to delete them, unfortunately delete_post_meta() takes post->ID for an argument, while I want to ...
Wordpressor's user avatar
  • 5,041

1
33 34
35
36 37
75