Questions tagged [custom-field]
Custom Fields are fields that can hold arbitrary extra information known as meta-data.
3,701
questions
0
votes
0
answers
31
views
Skip un-set meta fields ("Invalid field: fieldname") when using `wp post list` and displaying custom fields
We have custom fields called country
and coordinator.
This works:
$ wp post list \
--post__in=81153 \
--post_type=boardmember \
--fields=ID,post_title,post_name,post_date,post_status,country,...
0
votes
0
answers
16
views
Need help with graphs on my website [closed]
I looked for graphs plugin but no one seem perfect but I took help from Artificial intelligence and made a graph through coding but when I upload that code in to custom html. It won't let me publish ...
-1
votes
0
answers
11
views
I want students to be able to insert Mathematical notation for answer to QSM plugin question
I am creating a quiz using QSM plugin on wordpress.
I have mathjax also loaded.
I can i set you quiz so students can input Mathematical notation in their answers.
0
votes
1
answer
68
views
Can I count every article following extracted meta value?
I can show all value in certain meta key(species1 and species2) by my code below. It shows like this. $species[]contains many kinds of bird species.
Crow Eagle Crane Pigeon...
Now, I like to count ...
0
votes
0
answers
9
views
Adding amount to cart when input field is filled
I am trying to add a custom input field to a single product template in WooCommerce, which would add a fee of $20 to the cart total if the customer inputs data in the field. I have added a custom ...
0
votes
0
answers
13
views
SQL query based on two different custom field values
I have custom post type "store" that has two different custom fields: Coutry and City. When in the single country page I list all the stores in that country.
What I would like to do is to ...
0
votes
0
answers
13
views
ACF block gutenberg aligncenter don't work
I'm starting with creating Gutenberg blocks with ACF.
I would like to create a simple button, so far so good.
My problem comes from the center alignment. When I align my element to the left and right ...
0
votes
0
answers
11
views
Conditionally get ACF field in Wordpress nav walker based on parent menu item?
I am building out a mega menu for a site and I have some ACF fields set up that I want to display in each of the sub-menus in the navigation. I want to specify which field to used based on which ...
0
votes
0
answers
22
views
How to pull through page title depending on which radio button is selected on the specific page?
I'm pretty new to Wordpress, ACF and PHP.
I am currently working on a project, the website has 11 different sports centres all with different sport/activities, on each centre they will have a sidebar ...
0
votes
1
answer
152
views
Can't expose custom field to REST API
As far as I can tell, the following code should make the video custom field of my CPT project available through REST API. Yet the custom field is still not exposed.
Why not?
add_action('rest_api_init',...
0
votes
1
answer
28
views
Adding the numerical values from a custom field from all posts in a category
I have a blog that is documenting an airplane build process. Posts describe the work done each day, and are organized into a category for each component. Each post has a custom field for hours logged ...
2
votes
1
answer
51
views
Block Editor - Meta values not saved, meta changes to empty array on update
Issue TL;DR
I have a block that updates meta values, but when I click 'update', the values are not saved for the post. Additionally, the meta values I get from useEntityProp load as an object with ...
0
votes
0
answers
72
views
warning: trying to access array offset on value of type bool ACF field image group
I have a problem with an acf function for displaying an image by array.
I can get my image to work well when I upload it to the field associated with it.
On the other hand, when I don't put an image, ...
0
votes
2
answers
28
views
How to conditionally display an ACF custom textarea contents only to those users chosen from an ACF User field
How to conditionally display an ACF custom textarea contents only to those users chosen from an ACF User field.
I have an ACF User field (allowed_users)that author's can multiple select when they ...
0
votes
0
answers
12
views
Category display using conditions
I have a custom post type(events) created and has taxonomy(event-categories) with parent and child categories.
Since im not good in coding, i will try to understand all the help from here.
So what im ...
0
votes
1
answer
17
views
doesn't save custom meta box data wordpress
My WP doesn't save my meta box data. I see the metabox and the field, but the data doesn't saving. Somebody could help me? Thank you. This is the code:
<?php
// Function to add a metabox
function ...
-1
votes
1
answer
22
views
Custom rest fields not loaded in rest api cpt response
I have a custom endpoint that will be used from my vue app to load custom post type I've registered using a custom plugin. I need to add some custom fields to the response when the posts are loaded ...
0
votes
1
answer
34
views
Display WooCommerce Order Custom Field In Template (HPOS)
Until now, I used this code to display a order custom field value inside a template:
<?php echo esc_html( get_post_meta( $order->get_id(), 'my_custom_field', true ) ); ?>
When enabling HPOS ...
0
votes
0
answers
32
views
Use Custom Field to Display Post Loop
In my custom template I have created a menu which is a row of 10 horizontal tabs. Each tab shows a date which is defined using an ACF datepicker field in the post.
I have also created a custom post ...
0
votes
1
answer
17
views
Query custom fields with three dates - start and end does not work
I have tried to make a reservation system for a book a table in restaurant.
But, I have a problem when I try to see/ make new reservations in an specific day - in showing me which table are free at ...
0
votes
1
answer
17
views
Sort wp_query of two post types using meta datefield for one and date for the other - possible?
I have two queries that result in id-arrays that I merge into a common array which, in turn, has all the posts I need from the two post types (posts, events). However, in the sorted list I would like ...
0
votes
0
answers
9
views
update and sanitize a value of a select field
I'm trying to update and sanitize the value of a select field, this custom field is in user-edit-php
I,m using this code
update_user_meta( $user_id, 'saldo', sanitize_text_field( $_POST['saldo'] ) );
...
0
votes
1
answer
16
views
Why the value of the selector doesnt remain visible in the custom field after I edit the post?
I have a number custom field with a selector, I should select the number of bedrooms, when I edit the post the meta key value is saved correctly (I can see the number of bedrooms near the ...
0
votes
0
answers
26
views
How can I display a layout differently depending on whether the user is on Mobile or PC?
I am currently working on a website for which I have to display the different features of a product. When imagining the design, I had a very different layout for mobile and PC that would, in my ...
0
votes
0
answers
10
views
A custom field that can search through many other related post types?
It's been half a decade since I tried to make a wordpress site, and in the past I would use Advance Custom Fields to solve a very specific problem I'm about to ask. I want to see if there's a newer ...
0
votes
1
answer
68
views
hide "Open in New Tab" checkbox in link field
I added a custom field to a repeater with PHP:
[
'key' => 'field_sponsor_badge_url',
'name' => 'url',
'label' => 'URL',
'type' => '...
0
votes
1
answer
176
views
Custom fields in the billing address section woocommerce
I have added custom fields in the billing address in Woocommerce checkout page, this works fine.
Now I would like to show these custom fields inside the "billing address" box in the email ...
0
votes
1
answer
39
views
Change formatting of Date parameter on custom post type
So I have a custom post type called "wp_events", and I would like to update this portion:
Where is says "Scheduled 2023/11/05 by default, I would like this format:
Scheduled
November ...
0
votes
1
answer
279
views
get_the_ID() retrieves same ID on Gutenberg's Query Loop
I'm using Gutenberg editor and I want to add a shortcode (using XYZ PHP Code) that uses the post id to retrieve certain ACF value.
I'm editing the home page where the last blog posts are shown, but I ...
0
votes
0
answers
40
views
How to add image in wordpress custom plugin?
I am looking for how to add images in a custom database table using WordPress code
I am new in WordPress plugin development. I've created code for a plugin named store plugin. I've taken fields like ...
0
votes
0
answers
64
views
How to custom code the Elementor Loop item?
I have an Elementor Pro and ACF on my site. I have a custom post type with a custom field called document.
I want to be able to conditionally render the "Download" button with the document ...
1
vote
1
answer
23
views
What is the best way to get a different post's custom field/postmeta with js?
In gutenberg I want to get a postmeta (it's a json string) that belongs to post #123. I want to check the editor's content against it. Let's say that postmeta's key is "blocks".
So I made ...
0
votes
1
answer
171
views
How to automatically update ACF field value every year?
I'm using ACF in my custom post type and I have 2 numeric fields: one for Birth year and another for Age. I want to update the age field automatically based on the birth year field value. I found out ...
-1
votes
1
answer
23
views
Where can I find the missing page sections in wordpress?
This is not coding question. This question is related to Word Press
I am new to Word Press. I am now trying to edit an old word press website from my company and i am struggling to find a solution
...
0
votes
0
answers
72
views
Elementor form data to ACF
I've developed a webpage incorporating the Elementor Pro form widget to enable users to submit a listing on my website. enter link description here
I have utilized the ACF plugin to create all the ...
0
votes
1
answer
63
views
Replacing the deprecated function the_meta
the_meta is deprecated and it's told to replace it with get_post_meta.
I'm using since long time this function for custom fields without styles:
//the_meta function without styles:
function mymeta() {
...
0
votes
1
answer
44
views
Want to add custom post type for facebook feed
I have Facebook api for feeds. I want to add multiple user's Facebook feeds on their page. So, how can I add custom post type for Facebook feeds, which users can login to their account to get feeds ...
0
votes
1
answer
41
views
Fields are not displayed on front end under custom php code in Advanced Custom Fields and Flexible Content field WordPress
I use Advanced Custom Fields WordPress plugin and the Flexible Content fields. So in one of the fields I need to include a php file, so I do it like this:
<?php elseif( get_row_layout() == '...
0
votes
0
answers
72
views
additional fields based on the quantity of products selected
I have to make a site to sell course enrollments and to do so I'm using woocomerce.
both single people and companies who will make multiple registrations for their employees will enroll in the courses,...
0
votes
0
answers
24
views
Image inside the content is replaced with featured image from my older post
I'm trying to create a popular posts widget and display the images via this function:
function vp_get_thumb_url($post, $text, $size){
$imageurl="";
// 1) FEATURED IMAGE
// ...
0
votes
1
answer
99
views
get Custom field label (select/dropdown) on front end
I have custom field added to product posts.
This is dropdown field and displaying on front end it pulls the option value which is not display friendly, for example select option value is "...
0
votes
1
answer
40
views
ACF number less than comparison not working
I have two ACF fields named as “price” and “reduced_price” now i have another field named as “price_filter” which should be filled with following conditions,
If “price” is greater than “reduced_price”...
0
votes
0
answers
13
views
Search for meta_query does not return any result if combined with title
I'm trying to extend the wordpress search to include a custom cpt through the meta value associated using an ACF. All seems to works great, but the main problem's that I have to add this code to make ...
0
votes
0
answers
17
views
Postcode lookup that redirects user to nearest store page?
I have searched high and low for a Wordpress solution that would let me have a simple text field where a user inputs their postcode or area, and then the field lookups the lat/long assigned to various ...
0
votes
0
answers
119
views
How to consume external API from WordPress post editor and display the response data in the custom field?
I am developing a custom post type called "Team," where I will add some profiles of team members. I am using ACF for the custom field to add personal details of the members (I can also ...
0
votes
0
answers
20
views
Add custom text in second paragraph of posts in specific category
I am trying to display following custom text in the second paragraph of each post lying under category 'Blue Screen' (cat_id 128133):
Helpful tools to research and fix:
BlueScreenView
Whocrashed
...
1
vote
1
answer
88
views
Add custom information in editor summary
I made a custom meta data to my posts by using
register_meta( 'post', 'my-custom-field', [
'object_subtype' => 'post',
'type' => 'string',
'single' => true,
]);
That ...
0
votes
0
answers
33
views
Match submitted array fields with the MYSQL database fields to update them correctly in PHP
I have a database table with the following schema and would like to update it correctly when a booking form is submitted with the correct matching ticket type and ticket values:
listing_id
...
0
votes
1
answer
45
views
Order custom post type by posts with most likes first
I am using the Like/Dislike plugin on a custom post type and am trying to order the display of posts by the most like count down to those that have no likes (and no set meta value in the posts meta ...
0
votes
0
answers
17
views
Multiple triggers when publishing, saving or updating a post in WordPress
I have set up a webhook to be triggered when a post is published, saved, or updated on my WordPress website. The webhook includes the post ID, permalink, and a custom field with ID 'syncal' as JSON.
...