Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [custom-field]

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

0
votes
0answers
10 views

get_post_meta returning blank with wordpress cache

So, after i implemented some caching to my website when i create a post with a custom field the value on the field won't display on the front-end, only in the back-end until i clean my php cache, the ...
0
votes
0answers
4 views

connect woocommerce custom field to wp user meta upon customer registration

I'm adding a custom field on my woocommerce registration that actually saves customer IG usernames by using this code below placed on my child theme's function.php file: function ...
0
votes
0answers
12 views

Add extra field to the post featured image Wordpress 5.0

This code work well for old wordpress 4.8 to add custom field into featured image box. Wordpress 5.0 in not working with add_filter admin_post_thumbnail_html add_filter( 'admin_post_thumbnail_html'...
0
votes
0answers
22 views

Automatically populate custom taxonomy with a value from a custom field

I'm working on a real estate website, and right now we have a feed importing new regional listings automatically (RETS feed). Certain fields in the 'properties' post type that comes with the real ...
0
votes
0answers
9 views

Shortcode of Custom Post Type Metabox Array

I have an Custom Post Type which dynamically creates 2 textboxes, one for date and one for description. In my single-template I use the following code, which functions perfect. But when I use it in a ...
-1
votes
2answers
23 views

wp_query get data from advanced custom field in wordpress

I want to get the data from advanced custom field using wp_query from another custom post type: $title = get_the_title(); $the_query = new WP_Query( array( 'posts_per_page'=>9, '...
0
votes
0answers
14 views

Generate post content from meta fields

I have a custom post type (match). Each posts on this CPT has one ore more custom fields. Is it possible to automatic generate the 'post content' with the value of my custom fields on these posts? ...
0
votes
0answers
11 views

VAT Number in WooCommerce Emails - if empty dont't show

Is it possible that the NIP label and company name will not be displayed in the e-mail if the customer does not provide them. I use this code: add_filter( 'woocommerce_email_order_meta_keys', '...
0
votes
0answers
39 views

Query with multiple CPT but custom field for only one on them

I need the query with merge of two CPT posts (for example cpt1 & cpt2). The problem is when is need to add the 'variable' only for one CPT, that is the a custom field and relevant value (for ...
0
votes
0answers
9 views

woocommerce product sorting based on custom fields

I am trying to add a custom sorting option for woo commerce . So I am using following code to add new sort option plus set it as default meta key is '_am_cat_sort' function ...
0
votes
1answer
13 views

Sql Update CPT from publish to draft and particular custom field

I have: CPT: match custom field: played Is it possible by MySql to change the status from publish to draft of all posts of CPT 'match' with custom field set as '0'? A good start can be UPDATE ...
0
votes
1answer
34 views

How do you update post date (year only) in a separate custom field?

I would like to update all my posts with a custom field that stores the year the post was published. The "year" value will obviously be retrieved from the post's date meta data. I will then use the ...
-4
votes
0answers
16 views

how to make this type of search function [closed]

How to make this type of search and product listing in WordPress check link
-1
votes
2answers
18 views

Change post status by custom fields

I'd like to update my post status (of my own CPT) based on custom field "played". If played is 1 i want that the post shall be published, but if the custom field played is 0 the post shall be draft ...
0
votes
0answers
10 views

Custom post types & Pages hierarchy - Error 404

I've defined two custom post types: Theme Fiche I've also 7 pages using a defined rubrique template: (template-rubrique.php) Both my Theme and Fiche have an ACF post-object field. The Theme ACF ...
0
votes
0answers
28 views

Ordering Post by Meta Key (Not Working)

So I've read all the stack exchange posts on this, and I feel like what I have, based on what I've read, should be working. I'm a little confused as to why it isn't. $args = array( 'post_type' =&...
0
votes
1answer
12 views

Showing the post only when there is title, thumbnail and the content in Custom Fields

I am learning so please don't be cruel to me. I need Your help. I am trying to use Custom Fields and the loop is working BUT I have four sections and when the section contains the content is fine ...
0
votes
0answers
9 views

JSON ACF custom field type [duplicate]

I was wondering how can you make a new custom field type on acf and get JSON data from the url and when it got the data, put them on the same fields of ACF fields. Like these Mockup pictures: It ...
0
votes
0answers
30 views

Getting data from JSON - ACF Plugin

Is there anyway to get data for ACF fields from JSON? I mean for example you have a new post where you have your ACF fields there, how can you fill those fields by giving the JSON url to one of the ...
0
votes
2answers
26 views

How can php be used to return data from custom fields in a post?

How can php be used to the return data from a custom field in a post? Any help would be greatly appreciated.
0
votes
1answer
19 views

ACF Post Object meta-query by title not ID

I'm trying to query a post type (intervention) via a post object field (intervention_country) by the title (of the related custom post type - country). Something like: $wp_query = new WP_Query(); $...
0
votes
1answer
21 views

author.php not showing content if Author has no Posts

I am making a custom Genesis theme, and have a custom author.php file that pulls in various custom fields (Using Advanced Custom Fields), and author meta information to the page from the author ...
0
votes
0answers
12 views

Toolset category search but with links

I'm creating a project page where I use Toolset to display certain projects. They are all categorized, but I can only seem to do so by going to Views > myView > and then clicking on Search & ...
0
votes
1answer
8 views

How to get correct value from checked()?

I am trying to create 2 raido buttons as a category custom field, and in function.php I do: $feat = get_term_meta( $tag->term_id, '_feat', true ); <input name="feat" type="radio" value="0" &...
0
votes
0answers
21 views

Wordpress ACF oembed tweet only text and author?

I am quite new to wordpress, I need to have a custom field where customer can add a tweet (already added), but tweet must contain only Author, tweet text and how long ago it was posted. No images, ...
0
votes
1answer
22 views

get_posts() not working when accessing with a custom user role

I've stumbled across something that I can't seem to find any documentation on regarding WP 'get_posts' function. I've got a web application that has multiple custom post-types and multiple custom ...
0
votes
0answers
13 views

Add Cart Item meta data based on other items

I use the following function to show the discount in the cart if a product in the cart is on sale: function my_custom_show_sale_price_at_cart( $old_display, $cart_item, $cart_item_key ) { /** @...
-1
votes
0answers
28 views

How can I add a transaction type custom field to WooCommerce order?

I am developing a custom payment method for WooCommerce. My code is as follows: class WC_Gateway_Custom extends WC_Payment_Gateway { public $domain; /** * Constructor for the gateway. ...
-1
votes
1answer
18 views

Query posts by custom fields (object post)

As described in ACF documentation, here is the way to find all posts where a custom field called ‘color’ has a value of ‘red’. $posts = get_posts(array( 'numberposts' => -1, 'post_type' ...
0
votes
0answers
27 views

How do I add a custom field?

I am completely new to WordPress and was just playing around with it to figure out how it works. I stumbled upon custom fields for posts, and read that it should be possible to enable them in Screen ...
0
votes
2answers
28 views

How to get all wp_posts in wordpress fetched from database

I have downloaded a theme and installed it. Here the theme has custom fields for limited numbers. For ex. author_name, comments but, I want all the wp_posts to be displayed. And prior to that, ...
0
votes
0answers
31 views

ACF - get_field() using 'option' as post_id not working

I'm using the Advanced Custom Fields plugin and I have created some options pages with: if (function_exists('acf_add_options_page')) { website_settings_init(); } function website_settings_init() ...
-1
votes
1answer
32 views

Post Filtered by Custom Field Value

I'm filtering posts by a custom field value and it works if its just one but I want to have it so that i can enter the different custom field values multiple times in a post and have it appear in ...
0
votes
1answer
18 views

Custom fields multiple commas separated values

This code is working fine but when I add multiple commas separated values in custom fields value then It's not working. (Example:- Demo, Demo Two) $meta_query = array('relation' => 'AND'); if ($...
0
votes
0answers
29 views

Inserting Schema Markup (JSON-LD) Manually with Custom Fields or any Better Ways?

what is a simple and reliable way to insert schema markup (JSON-LD) in my static WP pages manually? My question is not about creating the JSON-LD code, but how to implement it in the WP source code. I ...
0
votes
0answers
9 views

Support auto-save and revisions for custom fields

I recently read this tutorial about custom fields in WordPress and wrote a simple plug-in to provide a metabox with a set of input fields. I do not use the Meta Box plug-in promoted on the web site. ...
0
votes
0answers
13 views

limit amount of photos uploaded per cpt post

On my site I have a front end form for users to create a post and upload images. It works fine however I cant seem to figure out how to limit the number of images per post. The image attachments get ...
0
votes
0answers
14 views

submitting form to admin-panel.php returns 500 error

submitting form to admin-panel.php returns 500 error <form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post"> <input id="user_name" type="text" name="...
1
vote
1answer
16 views

How to handle a custom form in wordpress to submit to another page?

I know in PHP I can just put action equal to random.php file and process the data there, but how in wordpress can I use already existing page with a custom template to submit a form to, so that after ...
1
vote
1answer
11 views

Adding number to date not working [closed]

I am adding number stored in custom user meta data to current date. Here is my code $addeddays = get_user_meta($this->order->user_id, 'xxx', true); $timeBase = date('j.n.Y'); echo date('j.n.Y', ...
0
votes
0answers
15 views

Show formatted custom post type with custom fields on page

I have created a custom post type called device using 'Custom Post Type UI' plugin. For this post type I've created some custom fields with 'Advanced Custom Fields' plugin. To show custom post type I'...
0
votes
0answers
11 views

Meta box built with loop have 1 error in input

I am making a loop to build metabox with several inputs. It is working , but there is something strange happening. When loop runs. all inputs are working fine except one. always the same one. ...
0
votes
0answers
12 views

Is it possible to remove a conditional value from WordPress custom metabox

Here I have attached the screenshot from MySQL for easy understanding. In this meta value a: denotes total no of users liked the post. User denotes user with id user-id My question : Is it possible ...
0
votes
0answers
17 views

Counting views looks like to count double

Within a shortcode I like to count my page views. Every time when i count a view with a custom field, it counts for 2 instead of 1. Does someone has any idea what could be the reason and how to solve ...
0
votes
0answers
17 views

Post Meta deletion ajax not working

I am trying to remove function in the backend of post like plugin. In the post like plugin they are storing values in the following manner that is User Id , Post id and comment (or) Post . ...
0
votes
1answer
11 views

Adding a Section for Visitors

I habe a basic dog care website where I would like to have a lost dog section where visitors can post about their lost dogs with pictures and custom fields like communication and location info. But ...
0
votes
0answers
29 views

Sort posts on custom field AND after that sort on date?

I'm having trouble to understand customizing the new WP_query. I've found the script below, partly, here in order to get the sticky posts. I've further edited it in order to: first get the (sticky) ...
0
votes
0answers
12 views

Error when moving custom post type to bin

I am creating my first WP plugin and I'm having a some issues when trying to move a custom post type to the bin. I have a custom post type and in this I have a custom meta box with four fields. I can ...
0
votes
0answers
12 views

Query Custom Post Type by Custom Field ID

I'm not sure if i've just been staring at this too long. To give some general info, I am trying to query custom post types based off another CPT's custom fields. Let me explain. I have a custom post ...
0
votes
1answer
22 views

Include woocommerce custom field value in front-end search result

currently the search result only showing all the woocommerce default product field (product title, category, tag, .etc). I've add a new custom field inside the woocommerce product using this code ...