All Questions
6,217 questions
2
votes
1
answer
993
views
handling csv data with a custom post type
I have a custom post type which represents a 'race' and there are meta fields for 'distance' (5km,10Mile) and 'type' (track,road,crosscountry). We get the race results as a csv file which contains the ...
1
vote
3
answers
1k
views
How to create a custom page(not a template) in a theme
I have been searching for theme developing info but all that are related to this subject are talking about a custom page at page.php.
What I am trying to achieve is different. The scenario is that I ...
1
vote
2
answers
1k
views
Assign Taxonomy Based on Custom Field Value
I have a custom post type "vegetables"
I have a series of custom fields for each month of the year as check boxes
I have a custom taxonomy "Seasons" that I want to assign based on what boxes are ...
0
votes
1
answer
847
views
Custom CSS is overwritten by WordPress?
So I made a new website for a club/ organization. My task is to update an old website on WordPress with this new website.
I transferred all my HTML pages and CSS/JS files. However, some of my custom ...
0
votes
0
answers
6
views
ACF pro auto populated field is not saving
I have auto-generated a text field value from another field in ACF pro. The field is showing the data but I can't use it anywhere. I assume it doesn't save or update. Here are my code
function ...
0
votes
1
answer
796
views
Unable to change checkout placeholder text
I am using woocommerce with storefront and on the checkout the placeholder text for address 1 is "street name" and address 2 is "apartment number".
In my country it should be the opposite, or all in ...
33
votes
9
answers
158k
views
How to Add Custom Fields to a Custom Post Type?
Ok, so I have registered a few custom post types and a few taxonomies. Now, for the life of me, I cannot figure out the code I need to add a Custom Field to my Custom Post Type.
I need a drop down ...
0
votes
1
answer
889
views
Adding Custom Metadata to my Archive/Posts page
I am currently working on a news website and using the Wordpress archive feature to display all my posts in a feed (when you click on the post titles you are taken to the source website).I need to add ...
0
votes
1
answer
725
views
Output Custom Field value to shortcode
I am trying to automate a whole bulk of my pages and one of the shortcodes I have created is to output the NextGen Gallery Tags by using the page custom fields that each page has a unique id. This id ...
1
vote
1
answer
920
views
Order by empty custom field
I order my posts by custom field faq-order. That's work for me:
$faqArgs = array(
'post_type' => 'faq',
'meta_key' => 'faq-order',
'order' => 'ASC',
'orderby' => '...
0
votes
1
answer
1k
views
UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
I inherited a project where, for some reason, the previous developer make a custom post type for authors and a custom select listing all those authors cpt titles in the post edit screen. This led to a ...
0
votes
1
answer
3k
views
Custom user registration fields in user_register hook
I am trying to send an email to administrator with user_register action hook and wp_mail() function when a new user registers. I created some custom registration fields and I want send them via e-mail,...
0
votes
1
answer
714
views
How to add meta fields to custom taxonomy add/edit page?
I have a custom taxonomy 'issue'. I tried to add some meta fields to the add/edit issue pages in the dashboard using the method explained by Ohad Raz (https://en.bainternet.info/wordpress-taxonomies-...
1
vote
1
answer
1k
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 ...
0
votes
1
answer
1k
views
Custom Meta Box (SELECT) Not Saving
I am trying to create a meta box with select options for each page with home-page-template.php assigned to it. I have got that functionality working correctly.
I also want it above the editor, below ...
0
votes
1
answer
12
views
Query 'orderby' when there are multiple values for the same meta_key
I'm trying to create a custom sortable admin column for a custom post type that contains a "repeater" field. The plugin I'm using for this field saves the values as separate entries in the ...
0
votes
3
answers
3k
views
Show only top 3 posts from 3 categories in order on home page
This function will show the last 3 posts from any category on front page:
// Only top 3 posts from CHR category
add_action('pre_get_posts', 'ad_filter_categories');
function ...
1
vote
1
answer
852
views
adding autosave feature to custom fields
Does anyone know how to add autosave feature for advanced custom fields or add acf to the autosave event.
I searched about it but I didn't find any solution.
thank you
0
votes
0
answers
57
views
Very strange problem with occasional 404 errors
I'm having a very strange effect on my website with occasional 404 errors.
First of all: This is not a normal problem with redirect rules or htaccess. So please don't make comments like "check ...
1
vote
1
answer
747
views
Saving Custom Field Data before Publish
When creating a page or a post WordPress lets the content (title, body, featured image) be saved when using Ctrl + S. The Custom Fields do not save in the same way (in this case I'm using Advanced ...
0
votes
1
answer
1k
views
Requiring a Visitor to Enter a Password Each Time They visit a Page
the pandemic has changed my role within my company so that I'm now doing all of our WordPress development, despite having zero training with WordPress. Feel free to include any comments about my boss'...
1
vote
1
answer
1k
views
Firing schema via code in functions.php doesn't work
I've been banging my head against the wall trying to get schema figured out, so if anyone can help me, I'd appreciate it greatly.
I'm trying to manually add my schema via custom fields, and then ...
0
votes
1
answer
823
views
Unable to gather Image URL from Custom Post Type's; Custom Meta Field
I have wrote a very basic plug-in, it creates a Custom Post Type (CPT) that has multiple custom meta fields.
I cannot seem to echo out the Image URL. I have tried a heck of a lot of other similar ...
1
vote
2
answers
897
views
How to retrieve attachments from child pages of a specific Page?
How would I retrieve attachments from all subpages of a specific Page ID?
Example:
SPECIFIC PAGE
Child (with attachments)
Child (with attachments)
Child (with attachments)
I'm currently ...
0
votes
2
answers
945
views
divide custom field values in div every two values
i have this html mark-up to sort some data
<div class="row">
<div class="col-xs-2">
<img src="images/member-schools/ms1.jpg" class="img-responsive">
</div>
<div class="...
0
votes
1
answer
921
views
How to I change the value of a custom field on the home page?
I'm new to WordPress and have inherited a site that uses Custom Fields.
In header.php there is;
<?php if(is_front_page()) : ?>
<div class="row">
<div class="col-md-4 header-...
0
votes
1
answer
867
views
Fatal error when accessing Pages in WP admin (and problems editing any pages)
I have a site that's been going for about 4 years with several hundred pages. I've had strange problems when accessing the Pages section (to choose a page for editing) and while in Page editing. These ...
0
votes
1
answer
1k
views
Metadata on the WP_Post object
I'm having trouble understanding the behavior of a WP_Post variable (and / or possibly the behavior of var_dump itself).
As far as I know, var_dump will inspect all data from a variable. From the PHP ...
0
votes
2
answers
809
views
Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)
I am using this to load css styles in the admin area (for any user who is not an administrator):
function wpse_admin_styles() {
if ( !current_user_can( 'manage_options' ) ) {
echo '<...
0
votes
2
answers
903
views
Sort posts by custom fields with empty values
I'm trying to list a few post sorting by a custom field value ("space-comments"). It's working very well, however, when the custom field is empty the loop don't get this post.
Any idea to fix it? ...
1
vote
1
answer
844
views
How to display custom option field in woocommerce orders in admin panel?
Actually this question has already answered as i already checked but i am unable to comment on that question as i am using the same code but in my scenario i am using options field and value is not ...
0
votes
1
answer
743
views
How to Save settings of custom tab product page in admin side in a database?
I have following code :
<tr>
<th><?php _e('Custom Stock Message'); ?></th>...
0
votes
1
answer
831
views
Get custom field from other post in carousel
Im using a plugin called wp carousel to display custom post types in a carousel in the footer in the singular view of posts. By default the plugin gets the featured image and the title of the post, ...
0
votes
1
answer
973
views
Category Archive not working for pages
I was wondering if someone could help me out. I have used this function:
function add_taxonomies_to_pages() {
register_taxonomy_for_object_type( 'category', 'page' );
}
add_action( 'init', '...
1
vote
3
answers
2k
views
Google Analytics tracking code on just one page?
Having an issue where I have a client who wants his Google Analytics code on just one page. I'm using the following is_page code but in the footer.php of my child theme, but it's not appearing on the ...
0
votes
3
answers
2k
views
Sort by an ACF field in a tax_query
I do not find the solution which must surely be surely simple. (I'm new to WP)
I have an ACF field named "partners_order".
I would like to sort it in ascending order (ASC)
here's what i tried
<?...
0
votes
1
answer
2k
views
Populate custom post type/custom fields from an external database
I have a custom MySQL DB(same host/different domain) with a lot of vehicle information.
What we want to do is populate a custom post type and custom fields with this data so that it's SEO friendly in ...
1
vote
1
answer
3k
views
How to create a custom post type with additional fields?
Beginner's question:
Looking for example how to create a custom post type with additional elements. What I mean is: in my code I have a basic stuff like 'title', 'editor' ... but I need also for ...
1
vote
1
answer
1k
views
How to add a user custom field into Woocommerce emails?
How do you add a user custom field into Woocommerce emails?
This is my code so far in functions.php
add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, ...
0
votes
0
answers
19
views
Inequality based on today's date and SCF date not working
I have the following custom query and I would like to exclude any posts whose SCF dates are in the past. I have checked that the custom date of the post is returned in the Ymd format and it is. I can ...
0
votes
1
answer
1k
views
ACF - Retrieve custom taxonomy from a relationship field
I have a custom post type, called prognosis with 3 custom taxonomies, Country, Competition, and Sport, I've also added a few ACF custom fields. I have another custom post type called analysis with an ...
2
votes
1
answer
768
views
Ordering Posts Type A by Custom Fields of related Post Type B
I'm not sure if this is even possible (also posted to ACF forum https://support.advancedcustomfields.com/forums/topic/ordering-by-custom-field-of-relationship-field-object/#post-62454)
I have two ...
0
votes
2
answers
903
views
Hide Admin posts & pages in Dashboard
Is it possible somehow to hide Admin's pages & posts from dashboard so that other users will only view/list non-admin publications?
0
votes
3
answers
7k
views
auto create only 1 wp page in activate custom plugin
I am using this code to auto create a page when I activate my plugin..
function insert_page(){
// Create post object
$my_post = array(
'post_title' => 'My post',
'...
0
votes
1
answer
2k
views
Advanced search form with multiple custom fields
I'm working in a site that allows to search for lawsuits about
medical malpractice, the client wants to have a search form almost equal to the one in this site:
http://psychcrime.org/database/
All ...
0
votes
2
answers
805
views
Selecting posts older than the current Unix epoch timestamp
I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate custom fields.
$args = array(
'post_type' => 'some_kind_of_posts'...
0
votes
1
answer
1k
views
Display content on Single page
I am building a single page theme, And I am having a problem with get_post_meta()
The Problem
This code bellow does not work, and I cannot see anything on the website as it's blank. Here is my index....
0
votes
1
answer
814
views
My WP homepage works, but the other pages don't when accessing from out side of my network
So, I host my WordPress website on my PC. 192.168.1.5:25566 (port forward). On my LAN, I can access homepage and other pages on the site. But from outside the LAN, I can access homepage but cannot ...
0
votes
1
answer
910
views
Post Click Redirect to Custom URL instead of Single Post Page
I have a custom post type called "articles". When an article link is clicked, I want to redirect them to custom URL(this URL is saved in the database as custom field) instead of the single page. How ...
0
votes
3
answers
1k
views
Query posts by multiple custom fields
I have made two dropdown list which is a custom fields.
Custom Field 1 :- industry
Values of Custom Field 1 :- financial_services,ecommerce,insurances, etc.
Custom Field 2 :- primary_functionality
...