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,559
questions
0
votes
0
answers
45
views
JQuery UI Autocomplete showing as bullets
The JQuery UI Demo page for autocomplete has a nice looking search box and drop down. When I implement it in my plugin, I end up with a bulleted list. How do I get my drop down of suggestions to look ...
1
vote
0
answers
21
views
Assign a value (got from an xml file) to an attribute of Woocommerce products
Good morning,
I should need to assign a value (value) from an xml file (that I export from my Warehouse Management System to My wordpress site) to an attribute I have already created 'unita'.
And each ...
0
votes
0
answers
54
views
make my custom theme support polylang plugin
I created my own custom theme with wordpress and now I want to add english language to my site (defualt is persian rtl). for this I installed polylang. I create menu in wordpress like this:
functuions....
0
votes
1
answer
320
views
YouTube embeds Cross-Origin Request Blocked (CORB) error
I am new to the WordPress world, please bare with me.
On my website have embedded some YouTube videos using the video block. I am seeing this error in the console:
Cross-Origin Request Blocked: The ...
1
vote
0
answers
34
views
Why jquery arrray return 0 value
The array in this function return 0. I am unable to figure out what the problem is.
function custom_woocommerce_auto_suggest() {
$search_query = sanitize_text_field($_POST['search_query']);
$...
1
vote
1
answer
38
views
Translating the "Everything" filter menu in Quicksand jquery file
I have been using QuickSand Jquery to display my WordPress portfolio.
Everything is working well. I just added the polylang plugin and would like to be able to translate the first item of the filter ...
1
vote
1
answer
28
views
On profile update check if user is Subscribed to emails?
I want to check if user is subscribed to email is checked. It uses "email_subscriber" meta key from a plugin.
If subscribed then assign role Email-Subscriber otherwise remove from role list....
0
votes
1
answer
27
views
How to create a build for quickly deploying a server with WP?
I have been looking for automation of a routine task for a long time: deploying a customized WP server with a pre-installed theme and plugins. The server must be on Nginx (optional OpenLightSpeed) + ...
0
votes
0
answers
35
views
Issue with modifying attributes on a Wordpress website (PHP)
I have a script responsible for the layout on a Wordpress page using the Traveler theme. I modified the order so that additional attributes appear below the description rather than at the bottom.
The ...
0
votes
0
answers
14
views
Woocommerce product search result page layout
I am creating a custom search bar with a category dropdown in my woo-commerce site so how do I fetch the exact design(HTML, CSS) of products in my search result as I am getting through shortcodes like ...
0
votes
1
answer
28
views
Help with commenting system
I am working on creating a commenting system for pages that are populated from a database. I have the main commenting portion working fine, what I need help with now is allowing replies. What I was ...
0
votes
1
answer
69
views
FATAL ERROR when I try to change the .php according to required and optional items rule
hope to find a solution here.
After having updated out php to PHP 8.0, we are having DEPRECATED alert. Most of them regards a required parameter that follows an optional one (making the second as ...
0
votes
1
answer
23
views
Nav Menu Short code Not working When non Login
I have made a toggle button with short-code for dark/light mode code below
function dark_light_toggle_button_shortcode() {
ob_start(); ?>
<!-- new button -->
<div id="...
0
votes
1
answer
72
views
stop resize button for wordpress media
The images in my WooCommerce product gallery do not need to be resized I only need the original image to display. Is there a way to add a toggle button to wordpress media to tell it to generate other ...
1
vote
0
answers
49
views
Responsive images, per image type?
I am new to understand responsive images. Unfortunately the resources out in the internet did not help me to fully understand the concept, so please bare with me.
I would like to know hdavidow if it ...
0
votes
0
answers
36
views
regsiter a new user through WordPress API with Google SSO doesn't work properly
I have a code that sends a Google's user data from NodeJS to WordPress and I can see the email registered but first of all it doesn't do auto-login and doesn't set a Name so I just see the email who ...
0
votes
1
answer
97
views
Send Webhook WordPress PHP
How do I send this line of code to the webhook? That is, when it gives the activate alarm, it should be sent to the webhook WordPress PHP:
register_activation_hook( __FILE__, function(){
$...
0
votes
0
answers
29
views
Single wordpress multi website down need help factoring what it is
A single website has gone down in our WordPress website multi-site. All the other sites work even using the same theme.
Solutions attempted Plugins removed Theme changed and removed. https://www....
0
votes
0
answers
20
views
Woocommerce attatch files and custom input meta to cart items and then to order
I have a product designer plugin to Print t-shirts and mugs. The plugin makes the Design in base64 but doesn't save the uploaded images to the media library. So I came up with a custom Ajax function ...
0
votes
0
answers
34
views
Display endpoint's return into a file (file_put_contents())
I've created a form (using WS FORM RUN WORDPRESS HOOK) than when submitted triggers a php script that grabs all the submitted data written on the fields and save them into $variables and everything ...
0
votes
0
answers
73
views
How to make this shortcode not refresh the whole page when i use it on frontend
everyone, I have this code that makes all the files in a folder visible and downloadable on the frontend through a shortcode. But I want to put it in Essential Addons' Advanced Tabs, and they don't ...
0
votes
0
answers
45
views
Loading a wordpress shortcode in JS
I made an ajax call to a php function, that should render a shortcode:
public function loadShortCode(){
$shortcode = do_shortcode('[elementor-template id="2635"]', false );
...
0
votes
1
answer
105
views
PHP Warning: Undefined array key "VirtualHostSubMenu" in index.php
I'm creating a new WordPress site but I'm hitting a WSoD when trying to access wp-admin. The only error present in all of the logs is PHP Warning: Undefined array key "VirtualHostSubMenu" ...
1
vote
1
answer
119
views
Wordpress post-template null warnings
I am getting these PHP8.0 Warnings from my WordPress site. The warnings are pointing to core code, not anything custom. When I turn debugging on there are no error messages on the site. I also checked ...
2
votes
1
answer
472
views
Dynamic PHP content in Block Theme template file
I am still adjusting to the paradigm shift to Block Themes after being away from WordPress for some time. I understand the practical reasons for many aspects of the Block Theme, and for the shift to ...
1
vote
0
answers
36
views
How to properly prepare a column name if passed to a stored procedure?
I've figured out that I can use %i with $wpd->prepare() to escape identifiers like column names. The thing is that the query I'm preparing is a call to a stored procedure like this. I want the end ...
0
votes
2
answers
221
views
Gulp dev environment set up for Wordpress theme development
I am slowly learning about WordPress custom theme development. I red that many people seem to be using gulp.js to automate many tasks and I am now trying to figure out the "best" way to set ...
0
votes
1
answer
360
views
How do I create a single.php file as the default template for single posts in the twentytwentythree theme?
I am trying to create a single.php file to be the default template for displaying single posts in a child theme that I have created from the TwentyTwentyThree theme. The reason I want to set this as ...
0
votes
0
answers
18
views
How to create a form that display license key (and email it to user) after the user enter their email and 10 digit code?
I want to create a form with 'email' and '10 digit code' fields that will display a license key which matches the '10 digit code' if it's correct.
The user will also receive an email with the license ...
0
votes
4
answers
67
views
id for categories and products
Is it possible to write code in functions.php that retrieves the tag_id of a product category and assigns the product to that category based on the tag_id field for the product?
I want to use tag_id ...
0
votes
1
answer
162
views
How to change post date and post time in Wordpress automatically with a function
I am not much of a coder but I have done research lately on how to change the post date and time in WordPress to the current date and time for all posts and I have not been able to get much.
If anyone ...
0
votes
1
answer
54
views
Issue with WordPress Plugin Activation Hook and Table Creation
Description: I am facing an issue with my WordPress plugin where the table creation process upon activation is not working as expected. Here are the details:
What I Tried:
Checked the SQL query: ...
0
votes
1
answer
118
views
Execute wp_after_insert_post after the permalink is customized
I'm trying to set a meta property to a new post's permalink using update_post_meta. When I run this on wp_after_insert_post I get a permalink that ends in "?p=[ID]". If I update the post to ...
0
votes
0
answers
13
views
not working visual tab when use wp_editor function in wordpress
i develop below code in wordpress:
wp_editor( 'ss', 'id', array() );
i use above code to create a metabox in custom post type.
this code create successfully TinyMCE editor wordpress but can't type any ...
0
votes
1
answer
193
views
Woocommerce, via php snippet: How to get product price and divide it by a number from an attribute, and then display the new price via php/html?
Hope something can help me, since php is unfortunately not my world:
I need to simply extract the product price of a woocommerce product, and divide it by a number taken from an attribute, and then ...
0
votes
1
answer
35
views
Bold Emails in Job Listings
I'm trying to create a function to bold e-mails in my job offers (the post type is job_listing), but it's not working and it's not giving errors at all.
function bold_emails_in_job_listings($...
0
votes
1
answer
346
views
How to get the content of a dynamic block in PHP
I'm trying to create a dynamic Gutenberg block. In my block.json file I have specified render php file. The block doesn't have any attributes, it just does an apiFetch in the edit function to get ...
0
votes
1
answer
52
views
Read data from external source. XML vs REST API
I have a WordPress site and I should read data from an external source to populate parts of the various pages. I can choose whether to have the external data in an xml or via rest api. The xml will ...
0
votes
0
answers
62
views
Tickera missing attendees - No attendees found
I transferred a wordpress site to azure (app-service hosted on linux with php 8.2). One of the errors was related to freemius used by tickera. The site was not loading. It was fixed with that plugin. ...
0
votes
0
answers
86
views
Get column block count using PHP method render_block
function get_column_count($block_content, $block){
if('core/columns' === $block['blockName']){
// get columns count
$columnsCount = count(array_column($block['innerBlocks'], 'blockName')); //...
0
votes
0
answers
27
views
Partial refresh in WordPress live preview
I have used the number input controller for the WordPress customization section.
By entering the new number, the whole page is refreshed in the live preview, and the reason for this is because of the '...
0
votes
0
answers
21
views
Remove slug of multiple custom post types with and without hierarchical
I have two custom post types called toplijst and product. I am trying to achieve the following permalink structure:
Toplijst:
website.com/toplijst/parent-toplijst/
website.com/toplijst/parent-toplijst/...
0
votes
0
answers
21
views
Session seems to break
I've setup a session in my custom plugin:
public function initializeSession(): void {
if (session_id()) {
return;
}
// this is not required, but add it anyway
session_name('...
1
vote
1
answer
29
views
Get variable from url
I'm having trouble getting a variable from a url. I tried the following 2 urls:
http://intranet/generalinfo/campusdirectory/index.php/personnel?page=1
http://intranet/generalinfo/campusdirectory/?page=...
0
votes
0
answers
38
views
fetch php file from js script (Stripe Checkout) 403 Error
Following stripe docs, I created 2 files in my theme directory (checkout.php & checkout.js) I can't figure out how to fetch checkout.php from checkout.js without getting a 403 error
Contents of ...
1
vote
0
answers
25
views
Failed PHP 8.0 Upgrade
We are talking about a website which is used not very often. Today I mentioned that we are running an old PHP-Version. So I logged into my provider's control panel and adjusted PHP.
Afterwards I had ...
0
votes
1
answer
44
views
Data insertion after clicking a button does not work (script, AJAX, PHP)
1 - the button "Choice" has Id "ButtonPubVideoHdp" in Elementor
2 - the file wp-content/themes/generatepress/js/wp_ajax_calls.js manages the click and calls
in the file wp-content/...
0
votes
1
answer
87
views
Wordpress Insert line in DB when clicking a button
when clicking buttonHdp, I wold like to launch the php code in order to insert a line in DB.
Script
<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
...
1
vote
0
answers
75
views
Custom plugin translation not working
I made a plugin that contains 2 custom gutenberg blocks created with react and jQuery (for some front-end stuff) and I'm having troubles translating them. There are no translation strings inside the ...
1
vote
1
answer
329
views
Call to undefined function create_function() - PHP 8.2
My wordress plugin is giving some issue. I am using 8.2 PHP version but the plugin is very old.
define('BBP_BBCODE_PATH', WP_CONTENT_DIR.'/plugins/'.plugin_basename(dirname(__FILE__)) );
//Admin ...