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
1answer
14 views

Order posts by meta key ( Using ACF )

Hey I am using ACF in media library and want to sort media by meta key (that is actually created by ACF). BUT it is not working. Here is the code: $gallery_imgs = get_posts(array( 'post_type' ...
0
votes
1answer
17 views

Where is get_post_meta value located?

I'm working on a wordpress website created quite long ago. In the header file I see the following code: <?php query_posts("page_id=63"); while ( have_posts() ) : the_post() ?> <?php echo ...
0
votes
1answer
21 views

User Meta Value not echoing despite Var_Dump Showing correct string

I am going absolutely insane with this one, I cannot for the life of me figure out why I am not receiving the string content. var_dump is outputting the correct result perfectly, yet the content for $...
0
votes
1answer
20 views

How to pass multiple custom fields as shortcode's parameters

I'm learning how to pass parameters in shorcode, I know the basic step after read through WP Codex. But for now, I have plugin come with custom fields and as the title, I want to know how to do it. ...
0
votes
1answer
11 views

Can't set custom meta fields for a post

I am trying to add some custom meta variables to a custom post type, but I can't see the new variables when I dump a posts meta data, and I can't access it in Here is the post definition from my ...
0
votes
2answers
26 views

Get data from PHP to JavaScript to set position of each post on front page

I've created a custom post type called project for my Wordpress theme, which works fine. Each project has several custom fields, including a set of x and y values that indicate where the project ...
0
votes
0answers
9 views

How to display Custom Field date_value in schema with hours

I just purchased an event listing website, and we have a custom section that allows us to post events with all sorts of information, from name to ticket price to start and end dates to hours, etc. It ...
0
votes
0answers
10 views

What are the options to let any one easily edit pages and background images for a page from dashboard without using a page builder [closed]

So, i want to custom code all my pages (no page builder), but need the option to be able to edit the pages from wp dashboard. What are the best options to be able to edit texts and background images ...
1
vote
1answer
34 views

Custom Meta Field - Remove comma from string with str_replace

I have a website that display car/vehicle listings. Each listing displays the PRICE. The price is set as a custom field on a custom post type, that is set to a string data type. The user typically ...
0
votes
2answers
30 views

How to update a custom field in all posts with the value of another custom field in the same post?

I try to get the value of the source field 'enddate', save it in the variable $enddatevar and write it in the target field 'promote' in the loop by activating the plugin, but the code I added to this ...
0
votes
0answers
16 views

Working If and Else If php calling ACF custom fields breaks on new page [closed]

I was kindly provided with a solution, in a previous post, that enables me to define use post category and category/tags along with If and Else If statements to determine what fields are displayed ...
0
votes
1answer
28 views

Sum All the Post Meta of Published posts of Current Logged in user

I found the below code to count post views in WordPress. I needed 2 things from this, which I am not able to do yet. Author stats: How to show the current logged in user, the total views of all the ...
0
votes
1answer
23 views

Saving Custom Field that includes Quotation marks

I have created a custom field in woocommerce that needs to be saved as 10"x10"x10". This is a measurement and needs to have the double quotation marks. I will display this in a custom tab on the ...
0
votes
0answers
12 views

How to keep custom checkout fields invisible?

I added two custom radio buttons to checkout page: function add_custom_selection ( $checkout ){ echo "<div class='type-radio'>"; woocommerce_form_field( 'custom_type', array( '...
0
votes
0answers
8 views

Check custom User meta before Insert

My goal is to check if my custom user meta field 'subscribe_to_newsletter' has been changed. If so i will be sending an API call to mailchimp to change the users status. I currently have a front end ...
0
votes
0answers
16 views

Need to display a Jan 1st post as the site's front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc

slightly unusual client request. I'm using Divi and I have a nice Divi layout created for a video and text post which is ready to go. The client wants to create 365 posts (one for each day of the year ...
0
votes
1answer
27 views

How do I get the value of a current user's custom field?

I'm trying to display the current logged in user's info in a particular page i'm working on, and i've managed to display some of the user's info. But I decided to add a custom field to the user's ...
0
votes
0answers
12 views

WP_Query to retrieve post based on meta data & taxonomy

I would like to show all posts under the "video" category & based on a specific option select on "codestar metabox". Here is my code: https://codeshare.io/adlXm4 I have added an option (switcher) ...
-1
votes
0answers
6 views

Deleted a Custom Field Group attached to a banner

My old website guy made a banner on multiple pages with pictures attached. I accidentally deleted the custom field groups so I only have the written content not the picture. The "TOP BANNER" is still ...
0
votes
1answer
9 views

How to convert Post Object Custom Field into Tags

so I've used this script in from this post to automatically convert an existing custom field into a tag. The problem is that my custom field is a Post Object. SO, it is creating a tag with the post ID....
0
votes
0answers
18 views

How to display multiple authors or co-authors based on custom fields?

I want to show multiple authors in one of post or may be single post as I want. Like in my WordPress website has around 7 Authors and I want to display Multiple Authors (2-3) or Authors using Custom ...
0
votes
0answers
19 views

Order custom post type search result order using custom fields

Here is my scenario: It's a real state theme based on wordpress. There is a "properties" custom post type. Buy page Includes a form, where user selects type of property, country and city (these are ...
0
votes
1answer
36 views

Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)

First and foremost - thank you to anyone and everyone who is taking the time to respond. I am a newer developer and I am sure I have a misunderstanding or something simple that I am missing. I have ...
0
votes
1answer
16 views

How to add fields in the WordPress editor?

how to add fields in the WordPress editor? I know there is a need to add persnalized fields in the editor but I want to save other information such as custom checkboxes Any idea to put a textarea ...
0
votes
0answers
26 views

Count tags for current post and save into custom meta field (and update it on post edit)

This question is sort of a follow up from another question on here Order posts by tags count? The first comment recommends counting the number of tags and saving it into a custom meta field. Going ...
0
votes
0answers
9 views

Wordpress Create Post Tag From Custom Field Function.php

does anybody knows to create post tags using custom field. I have post submission with date picker (it's custom field) then I want to convert the value of my custom field become post tags using ...
0
votes
0answers
33 views

WordPress Admin - Automatically Sort Custom Posts by Custom Field Date Value in d-m-Y Fomat

I have a custom post type called 'Courses'. I'm currently trying to automatically display them in the dashboard 'Courses' post list sorted by a date value specified in a custom field. The date value ...
0
votes
0answers
12 views

Load respective custom field as input field when the select option is changed

I have 2 custom Posts Type Subject Clusters ( is a group of subjects) Subjects So when a new cluster is saved, it saves a group of subjects. Subjects (2nd custom post type) can be added via a ...
0
votes
1answer
36 views

Programmatically add Yoast meta description after post save

I'm building a website and I need to have the Yoast description programmatically added after saving a post (a custom post type in my case). Now, since I'm using Advanced Custom Fields, and I also ...
1
vote
1answer
31 views

How to update custom user meta field in wp?

I use the following to add and display new user meta fields on the user profile editor screen but when I click the update button, the values don't change: function extra_user_profile_fields( $user ) {...
0
votes
0answers
23 views

Modifying custom order item meta from admin order view

I'd like to have a simple custom meta for order items that says if the item has been fulfilled or not. I have this in my functions.php: add_action( 'woocommerce_admin_order_item_values', '...
0
votes
0answers
10 views

Adding an extra checkbox to product attributes

I have a few product attributes. I would like to add a checkbox there, with name "Display on product list". If this checkbox is checked, then this product attribute should display on front-end, on ...
0
votes
1answer
14 views

How do I query with multiple custom fields orderby in same column?

I have a list of posts, one column of which I am trying to set in alphabetical order. The problem is that these posts have one of two different custom field value types shown in the same column. One ...
0
votes
1answer
29 views

How To Tell If a Custom Field Was Made with ACF, Metabox.io, Carbon Fields, Custom Built, etc?

I am working on a plugin that will be using custom fields, but was curious if there was a way to tell which plugin/library created those custom fields. The reason I am trying to find this distinction ...
0
votes
0answers
14 views

How to update a custom post types meta box on publish

I'm trying update a meta field on a custom post when it's published, but it isn't working for some reason. My code is as follows: function add_rand($post_id){ $result = update_post_meta($post_id, ...
0
votes
1answer
34 views

How can I add different custom fields for each category in the same post?

I am trying to add different custom fee fields for each selected category in the same post/course. Here is an example:- Course Name: B.tech Categories/colleges: college 1, college 2, college 3, ...
0
votes
0answers
13 views

Very large list of options for BuddyPress profile fields

I’m making a site with BuddyPress xprofile fields which can have up to 40000 options. I already loaded the options into the db via csv file. Now the site loads very slowly and is basically unusable. ...
0
votes
0answers
11 views

Crate SQL view in WordPress database from custom post types and fields

I'm trying to create a mysql view inside WP database that selects and then show some custom post fields. E.g.: with custom post types Movies and Reviews create an SQL view with movies name, ID and it'...
0
votes
1answer
18 views

Is it possible to populate a custom field with content from a page

I have a custom field defined as content_from_page. I want to populate the Value of the content_from_page Name with content embedded within the page. I plan to dynamically change the page's content ...
0
votes
0answers
17 views

Store CPT 'Reviews' average ratings to a WordPress DB table or to a DB custom table?

I am working on this portal in which users can review the services (with description and rating) of a cultural place. BASICALLY, I created two Custom Post Types (CPT) with Pods, one is ...
0
votes
1answer
66 views

Display a post from custom post type only if all the selected taxonomies and custom field value matches the record

I have created a custom post type exam_result with academic_year as a custom taxonomy, school_class as a custom taxonomy and roll number as a custom filed using the Advance Custom Field plugin. The ...
0
votes
1answer
22 views

How do I display an article using a WordPress custom field?

I want to display 3 articles with specific custom fields on the front page. The article needs to contain "featured" fields and the value is true. If the article does not exist, 3 random articles are ...
0
votes
1answer
31 views

Query against multiple locations within single custom post type post

I have a custom post type for "Events" and each event can have a variable amount of "Locations" (lat/lng) which is stored as meta. I need to be able to get "Event" posts based on the bounds of a map. ...
0
votes
0answers
28 views

Getting yoast title for custom taxonomy

I have created a theme template for a custom taxonomy. The HTML title tag has the yoast title that I set when editing the taxonomy. I want to also make this the title of the page. I cant seem to ...
0
votes
2answers
43 views

Create custom post with meta field with AJAX and the Wordpress REST API

I have created a custom post type and I got it to show in the REST API. I have also registered a custom field using the following code : function slug_get_post_meta_cb( $object, $field_name, $...
0
votes
1answer
94 views

PHP Warning with Custom Fields

For the love of God can anyone help me? My theme I had built a year or so ago, I added custom meta boxes/fields. I have created numerous custom taxonomies. But I didn't want the custom taxonomies to ...
0
votes
0answers
18 views

Inserts of Custom Fields to postmeta are not persisting

I have a script which, after creating a post, inserts a number of rows into wp_postmeta for the just-created post. The rows are inserted, and opening the post for editing shows these values where I ...
0
votes
0answers
23 views

Custom meta fields not showing up in WP_Response Object via custom endpoint

I created my own Custom Post Type called person and a corresponding end route. I can modify my posts with the endpoint, using functions as wp_update_post,wp_insert_post and get_posts. I am facing a ...
0
votes
2answers
31 views

Make the checkbox meta field checked by default

I have created a page for plugin. For that page i have added a checkbox meta field. The field is working fine. By default, the checkbox field is unchecked. I mean at first to active the plugin, the ...
0
votes
1answer
44 views

WP ForLoop to compare meta information of posts to determine what post to display

The short of what I am trying to do here is: I want to display only one post based on a date stored in a custom field. I only want to display the post if it meets two conditions 1: The date needs to ...