Questions tagged [php]
For questions about the server-side programming language that the WordPress core, plugins and themes are written in. Questions about using PHP outside a WordPress context are off-topic but might be asked on Stack Overflow.
10,576 questions
0
votes
0
answers
5
views
Make URL of a post pretty using JetEngine
I am currently using JetEngine and I have created a Custom Post Type named Creator. I also created a Taxonomy named Creator Categories. I have a Creator post named Beyond the Wall which I assigned a ...
0
votes
0
answers
12
views
Alerting woocommerce new order recipient dynamically [closed]
I have the below code which adds an email address stored in ACF fields to the new order email depending on if the user is checking out in GBP or EUR currency. This works fine, the problem I am running ...
1
vote
1
answer
34
views
Wordpress and php 8.1
I am trying to run wordpress 6.7.1 on ubuntu 24.04 with nginx and php8.1-fpm.
This is a fresh wordpress install with theme Twenty Twenty-Five and no plugins installed.
I also disabled any cache.
I am ...
0
votes
1
answer
23
views
Wordpress website not loading
I downloaded an entire existing wordpress website from a filemanager. I also setup the database for it, by exporting/importing the existing database. I also modified the siteurl and home field in ...
0
votes
0
answers
13
views
How do I ensure that the URL parameters are updated correctly when multiple filters are applied
I am writing a product filter, and ran into this issue.
I have 2 different attributes of my product filter:
Tilt -- as a checkbox with "Yes" or "No", and Multibrand Compatible -- ...
0
votes
0
answers
18
views
Custom Welcome Message Text That Accompanies Sound Player Suddenly Out of Alignment [closed]
I have a custom welcome message at the top of my site just below the main title text. It's a sound greeting that rotates between three audio bytes when the page is loaded with an accompanying title ...
0
votes
0
answers
17
views
Filtered queries not responeding to page path
I am writing a product filter, and ran into this issue.
I have 2 different attributes of my product filter:
Tilt -- as a checkbox with "Yes" or "No", and Multibrand Compatible -- ...
0
votes
0
answers
19
views
Change Query Var from s to q
Hi I have kind of an unusual task that I'm not sure exactly how to approach. I would like to change the query string shown in the url bar to use “?q=” instead of “?s=”
I am using Elementor as well as ...
0
votes
0
answers
16
views
button for resetting all the custom meta fields
I’d like to have a button to reset all the custom fields for the prices, the button should operate from the author (agency) edit page because I’d like to clean the prices of all the apartments (posts) ...
0
votes
0
answers
25
views
PHP Status Indicators
I am not a developer at all but I have figured quite a bit out myself.
I have a website that shows my Employees/Users as online, offline or busy. I have made PHP Status indicators for each person with ...
0
votes
0
answers
5
views
Display all products outside of filtered function
I have a products page which displays products based on filters. I believe I have found the code in which all of the products are queried. Normally, if a customer selects an attribute such as '...
0
votes
1
answer
23
views
Filtering with Attributes - how to display all non-queried products below query
I addded attributes to filter out products, based on their selection. For instance, I have field named 'tiled' as yes or no. If person ticks 'yes', all the products with the attribute of 'yes' are ...
0
votes
0
answers
12
views
How to Modify Gallery Preview on Edit Screen on the "Visual" Tab in Classic Editior
I am modifying the gallery_shortcode() function from media.php using a plugin.
How do I make my custom gallery structure show up as the preview on the edit page. I want to change how it displays in ...
0
votes
1
answer
9
views
Can you open a media frame to sellect an attachment to associate with another attachment you are editing on an existing media frame?
I want to have a media frame that pops up on click of a button on an existing media frame.
This way I can associate another attachment with that attachment.
This question shows an example of you can ...
0
votes
1
answer
30
views
How to create a dynamic url with post title from one website to another?
Since I am new to PHP, i have a question.
I've searched a few days on the internet, but don't really find an answer. I have also tried a few plugin's, but nothing replies to my wish...
What I want to ...
0
votes
0
answers
11
views
Trying to change the default page break numbering format
You provided an answer on the below post, I wanted to ask if this should work on Wordpress posts or pages, Im trying to do something similar for posts but I added your code to functions.php and it ...
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
0
answers
9
views
WP_Options tabel randomly increasing in size indefinetly
I have a problem with my wordpress page (woocommerce store, woodmart parent theme), where the wp_options table in my database gains almost 50MB in size, in what I thought was approximently every 10 ...
0
votes
0
answers
15
views
Flat Rate Shipping Based on custom region dropdown field
i have custom dropdown field on checkout page For region select.
Have 2 rate:
For Region X with cost 5$ (flat-rate:34)
Second for all others with cost 10$ (flat-rate:35)
I want to set rates on field ...
0
votes
1
answer
32
views
Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
Looks like this has been introduced in WordPress 6.7 - I have the following code:
$loaded = load_theme_textdomain(MY_TEXTDOMAIN,get_stylesheet_directory() . '/languages'); // internationalization
$...
0
votes
1
answer
21
views
Allow HTML in custom taxonomy description, and show it on front end
Sorry I'm quite new at coding, and also working with WordPress and ACF, and I'm trying my best but I can't figure this out:
I'm trying to load my taxonomy description in rich text. Currently I'm using ...
1
vote
1
answer
22
views
How to customize WP_Error (REST JWT authentication plugin) [closed]
🔖 Background & Environment
WordPress
6.6.2
JWT Authentication plugin
1.3.4
Php
8.3
I'm using the recommended plugin JWT authentication for WP REST API, to authenticate my users.
Asking /wp-...
0
votes
1
answer
14
views
get_var not returning a value when the field contains an apostrophe
I am trying to run a comparison on 2 tables based on last names. However, if the fields contain apostrophes, the query returns a blank result. If it doesn't contain an apostrophe, it will return the ...
1
vote
0
answers
40
views
Display posts in correct month order using single date custom field
I have developed a WP Query that displays posts from a custom post type and taxonomy, and orders them by date using a custom field.
The posts have a single Advanced Custom Fields date picker field ...
0
votes
1
answer
28
views
Pass WP data to javascript
I'm using data attributes to pass product price calculation formula to javascript. Is it possible to pass it to javascript without being displayed in page source code?
0
votes
1
answer
23
views
When a foreach loop is used multiple times in blocks, is there a way to ensure a variable always has a unique value?
I'm a bit new to this so sorry if my explanations are a bit daft.
We use custom gutenberg blocks on our site. One of them is a FAQ block where you can add questions/answers and they display as an ...
2
votes
1
answer
34
views
Set custom post type to load custom block pattern by default
I have registered a custom block pattern for use on my non-full site editor WordPress theme. The pattern is available to be inserted in default and custom posts. Now I am wondering how it can be set ...
1
vote
1
answer
38
views
Application Passwords only for admin user? [closed]
I was wondering if it is possible to only allow the Application Password feature for admin users. I have found this page about it: https://make.wordpress.org/core/2020/11/05/application-passwords-...
0
votes
0
answers
16
views
Why does my custom slug only show in Gutenberg editor after page refresh?
I'm using an acf field to create a custom slug for a post type. Everything works and saves correct in the database. Only the shown value of the link field in the backend is not updated on publish. I ...
1
vote
1
answer
31
views
Prevent publishing of uncategorized posts
I'd like to prevent posts under the default category named "affitti" to be published. I tried this but with no effect
function prevent_default_category_publish($data, $postarr) {
if (...
0
votes
1
answer
24
views
Adding a variable to some PHP code with gettext
The year in the following code, that is to say “2024”
$titolo_display_price = '<div class="titolo_listino_prezzi" ID="titolo_listino_prezzi">' . '<h3 class="...
0
votes
1
answer
15
views
How could I prevent using the same custom loop in a template file when I only need to change one meta_query parameter?
I am displaying a set of upcoming fixtures for two cricket teams on the same page. The fixtures are created from a CPT and the relevant team is selected from a custom field.
I have everything working ...
0
votes
0
answers
12
views
Issues applying JSON body filters in EU F&T Portal SEARCH API with WordPress integration
I am trying to use the SEARCH API service of the EU F&T Portal public REST APIs for retrieving data for further integration with my project, but I am having some problems. I am using WordPress as ...
0
votes
1
answer
22
views
How to return count number from a wordpress database
I have a database 'wp_db7_forms', with fields, 'form_id', 'form_post_id' and 'form_date'.
I am trying to get a COUNT of the number of entries for a specific 'form_post_id'.
With this sql query in ...
0
votes
2
answers
16
views
Username as Tax_Query Term
I'm hoping someone may be able to point me in the direction of where i've gone wrong. I have a page which has a shortcode to pull through Referrals for the currently logged in user.
It just needs to ...
0
votes
0
answers
12
views
Facing 503 error on PHP files after deleting hidden files from the root folder
I am in the process of transferring my Wordpress website to Zume hosting. The website was working fine on my previous hosting provider. After uploading the files and database to Zume (using file ...
0
votes
1
answer
18
views
Custom theme on multisite has issues with standard loop output
I am experiencing the following error output when using the standard loop on page.php and single.php on a multisite-based WordPress installation. The loops are the same for both template types, with ...
0
votes
1
answer
41
views
White Screen of Death on Wordpress Website
A white screen of death is displayed on my website. No matter which page you are on, it remains completely white. The Wordpress admin panel is not affected and is completely accessible.
My website ...
0
votes
0
answers
23
views
Prevent render in editor via PHP
Simple ACF Gutenberg Block that I would like to use as a wrapper for other content (using <InnerBlocks />). The block's only field is a Link that wraps all of the content in an <a> tag.
...
0
votes
0
answers
25
views
How to connect input of information in wordpress and sending it using php to the VDS?
How to connect input of information in wordpress and sending via php on VPS (the site itself is on hosting)?
With the second one it is still clear (inserted via snippet):
$remote_ip = 'smth';
$...
1
vote
1
answer
57
views
Unable to remove action from parent theme via child theme
The Blank Slate theme (in its functions.php) adds a jQuery script to each page, which I would like to remove:
<?php
/* ... */
add_action( 'wp_footer', 'blankslate_footer' );
function ...
0
votes
1
answer
18
views
I've added SKU to Woocommerce permalinks, but I have small issue
I code number 1 in functions.php and number 2 in .htaccess to get product permalink based on SKU.
Something like this: xyz.com/product-title/#sku
How could I remove "#" from the permalink (...
1
vote
0
answers
24
views
Disable astra_get_search_form from generating in header [closed]
I have a website with an Astra child theme.
Astra is generating a search form in my header.
The form is generated 4x by Astra, and as the method="get".
I don't use this form, and there is ...
0
votes
1
answer
23
views
Hide ID for WordPress User Role Subscriber
How can you Hide a specific Page or Page ID or set of CSS IDs for user Roles that are not admins? Specifically User Role (Subscriber)
I've tried
global $post;
$post_id = $post->ID;
if( $...
0
votes
1
answer
51
views
Is it possible to remove the "Shop" title from the WooCommerce catalogue? [closed]
I own and run a gaming website. The games are listed in a WooCommerce catalogue (this was set up prior to my acquisition of it).
Whenever the games catalogue page is loaded, the title "Shop" ...
0
votes
1
answer
25
views
Function extension
I have the following code:
function auto_link_post_titles( $content, $post_id, $field ) {
$excluded_ids = array(); // Put the IDs of the pages you want to exclude here
$excluded_field_names = ...
0
votes
1
answer
30
views
Remove "Forum" from BuddyPress group creation step
In WordPress, I have BuddyPress and bbPress installed. bbPress creates an integration with BuddyPress where you can add forums to BuddyPress groups.
I want to remove the "Forum" step from ...
0
votes
0
answers
49
views
Enable logical for function
I have the following code:
function auto_link_post_titles( $content, $post_id, $field ) {
$excluded_ids = array(); // Put the IDs of the pages you want to exclude here
$excluded_field_names = ...
0
votes
1
answer
15
views
Function exclusion for a plugin
I have the following code:
function auto_link_post_titles( $content, $post_id, $field ) {
$excluded_ids = array(); // Put the IDs of the pages you want to exclude here
$excluded_field_names = ...
0
votes
0
answers
27
views
Custom PHP contact form issue
I'm building a WP website with a custom contact form in PHP, HTML and Javascript.
The issue is when the user click the submit button to send the form, it redirects to a 404 page.
The PHP function:
...