Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
0 answers
19 views

Modifying Slider Function for Decimal Precision

I'm working with the WordPress Traveler theme. In the Tour option, there is a slider used for Max People. Max People will be used for another purpose and should work with a precision of 0.1 instead of ...
tbo812's user avatar
  • 11
0 votes
0 answers
43 views

How can I change text on my SearchWP search results page, as this is not an editable page in Wordpress?

I just want to change the text "Search results for:" to something else e.g. "All results for:" The class is .page-title. I can't find this anywhere and I cant edit the page html as ...
Joseph Lewis's user avatar
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 ...
Tuba Saif's user avatar
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 ...
Giak's user avatar
  • 11
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....
Alipvd's user avatar
  • 3
0 votes
1 answer
323 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 ...
kocjs's user avatar
  • 23
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']); $...
Tuba Saif's user avatar
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 ...
made leod's user avatar
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....
Ali's user avatar
  • 11
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) + ...
Astraport's user avatar
  • 121
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 ...
tbone's user avatar
  • 101
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 ...
Tuba Saif's user avatar
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 ...
Darth Mikey D's user avatar
0 votes
1 answer
70 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 ...
Federica Cilli's user avatar
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="...
Atiq Rev's user avatar
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 ...
Monoor's user avatar
  • 13
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 ...
kocjs's user avatar
  • 23
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 ...
Mostafa Ezzat's user avatar
0 votes
1 answer
99 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(){ $...
RezaEllaros's user avatar
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....
Jeremy Thomas's user avatar
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 ...
mysticalghoul's user avatar
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 ...
WinterCold's user avatar
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 ...
Maellion's user avatar
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 ); ...
Jan's user avatar
  • 33
0 votes
1 answer
107 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" ...
Elijah's user avatar
  • 1
1 vote
1 answer
122 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 ...
Dawn's user avatar
  • 43
2 votes
1 answer
475 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 ...
JDQ's user avatar
  • 149
1 vote
0 answers
37 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 ...
Compjeuter's user avatar
0 votes
2 answers
224 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 ...
ghost's user avatar
  • 3
0 votes
1 answer
367 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 ...
Shanahando's user avatar
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 ...
Tom532's user avatar
  • 1
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 ...
Account1's user avatar
0 votes
1 answer
163 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 ...
tee's user avatar
  • 1
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: ...
pervez's user avatar
  • 1
0 votes
1 answer
120 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 ...
Tim Troiano's user avatar
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 ...
Mohsen's user avatar
  • 1
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 ...
Bjørn Erik Sandbakk's user avatar
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($...
Metin Tugaz's user avatar
0 votes
1 answer
347 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 ...
tsvetko.krastev's user avatar
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 ...
Stefano Vet's user avatar
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. ...
mihkov's user avatar
  • 121
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')); //...
blockwrangler's user avatar
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 '...
Benjamin's user avatar
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/...
sem roijackers's user avatar
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('...
Jan's user avatar
  • 33
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=...
Darth Mikey D's user avatar
0 votes
0 answers
39 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 ...
Mateusz Delegacz's user avatar
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 ...
Karl Exler's user avatar
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/...
Jean-François Moulin's user avatar
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($){ ...
Jean-François Moulin's user avatar