The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
0
votes
0answers
22 views

wp_post_delete is deleting all offices

Below, I will supply the code that I am using right now to distinguish between my offices: function import_offices() { $log = []; $name = 'octopus_import_offices'; $settings = ...
-1
votes
0answers
12 views

500 error: Custom Lite Plugin With “Advanced Custom Fields”

I always have 500 error whenever I add this to my plugin folder <?php function chk() { global $post; if(is_page() || is_single()) { if(get_field("geobot") && get_field("...
0
votes
0answers
14 views

Jquery no more loading, load-scripts.php not found (404)

When I open my wordpress website admin panel jquery is not working anymore (it worked yesterday and I don't see what I changed that can explain that). The first javascript error I have is GET https://...
0
votes
2answers
18 views

Change text string in a plugin

I'm using the WooCommerce Waitlist plugin, but I'd like to change it to be for products that haven't been released yet, ie for "expressions of interest". To do this I need to change a lot of strings, ...
0
votes
0answers
8 views

How to edit hero-section entry-title for Genesis child theme 404 page

I'm using Genesis >> Business Pro child theme. I've created a custom 404 page in my child theme. I've gotten everything to work EXCEPT... I need to change the title of the page, depicted in the ...
0
votes
0answers
10 views

How could I use action/filter hooks to insert new fields for a new tab in the 'Add-Fields' Plugin? [on hold]

I have recently begun learning la-ravel for use in developing word-press plugins. I have ran into a problem as I have no idea how I could add more tabs to the 'Add Fields plugin' that a potential ...
0
votes
0answers
22 views

Gravity Forms Populate Fields From Another Field [on hold]

I have a Gravity Forms form with multiple pages. Page 1 asks for a store #. I want page 2 to auto-populate meta information from that store (which is set up as a user using role "shop") using a ...
0
votes
0answers
12 views

Executing PHP not related to wordpress - correct folder? [on hold]

I want to execute a php file that accesses databases that have nothing to do with wordpress. Many years ago i wrote a VB app on windows desktop that could access MySQL tables on a website remotely. ...
1
vote
0answers
24 views

Preg Match All doesn't Allow echo first character for Wordpress Taxonomy Tags

I have been working on a code, that finds particular words from my content and converts them to wordpress Taxonomy Tags. I want to prefix them with a '#' symbol... But somehow it doesn't work This is ...
0
votes
0answers
22 views

Suddenly got alert when trying to login to admin panel of wordpress

Suddenly starts receiving alert when trying to login to wordpress admin panel. Hosting is on IIS server. It is type of alert prompt box given by firefox browser only with following text: To display ...
1
vote
1answer
18 views

wp_insert_post not working

I'm trying to get the movie info from the omdb web service and it worked fine but it doesn't work when I want to use wp_insert_post to create new posts. This script acts as the user enters the movie ...
-1
votes
0answers
13 views

Automatic Email a Data [on hold]

One of my website has php page which actually functioning for tracking of my website data now this functionality leads me to very heavy database space in around mbs in just week so i wanted to ...
0
votes
0answers
16 views

Prefix Wordpress Taxonomy Tags With Hashtag Symbol Like Twitter

How can I add a hashtag symbol before each tag in my WordPress website? My intent is that WordPress tags like 'Apple' should get converted to #Apple' I am the owner/developer of the site https://...
0
votes
0answers
14 views

Conditional Firing of WooCommerce Webhooks [on hold]

Currently working on a subscription-based website and I'm looking for a way to control whether or not the order.created WooCommerce hook is fired based on certain attributes of products in the order. ...
0
votes
0answers
5 views

gravity form list control [on hold]

List control dynamic generation add and remove list field and sum of total field value in another text box in gravity forms. enter code here
0
votes
0answers
29 views

wp_ajax_ 400 Bad Request

Trying to run a ajax request back to a function and keep getting a 400 error. this is the code below wp_register_script('frontend_js', plugins_url('/js/frontend.js', __FILE__), array(), false, ...
0
votes
0answers
18 views

Site infected by link

my store (woocommerce) is blocked by anti-viruses. I found that the following link is added to the footer without my knowledge: <script src = "// minisrclink.cool/1e40c8bd4601a5a5a4.js" async = ""...
0
votes
0answers
11 views

Add widget area from visual editor

Is it possible to add a widget area to a custom wordpress theme? I've read many guides and I'm finishing to build a custom theme that will embed a simple layout builder based on shortcodes. I have my ...
0
votes
0answers
5 views

Cron: Run PHP script with functions of WP plugins

I need to run a PHP script at a specific time (so no wp-cron) and it needs functions from a custom WP plugin. How could I accomplish that? Ps. I can't install any external libraries but I am able to ...
0
votes
0answers
15 views

Loop through an array and find the ID in another array

So I'm having some trouble with my looping and I would like to resolve it if possible. Below, I will go into detail on what I currently have: $test = strtoupper(str_replace(' ', '', trim($record->...
0
votes
1answer
22 views

WooCommerce - Reset quantity input field when variation changes

Is there a way or a plugin to reset quantity input field every time a user changes the variation? I searched but i didn't find something similar or any hook. I tried the following jQuery event but it ...
-1
votes
1answer
11 views

How to show only part of product name in category page - Wordpress with woocomerce

I want show only part of product name in my website, but show full name only in product page, Checkou, Cart and Invoice, like this: Some one can Help me?
0
votes
1answer
34 views

Save custom field on WP_List_Table

I have a custom field which is named clicktripz_object_location. I've created a WP_List_Table with the following code; if(is_admin()) { new UCO_Wp_List_Table(); } /** * UCO_Wp_List_Table class ...
0
votes
0answers
15 views

How do I create a page that lets users upload a csv file and import the file into a database table

I have a requirement to create a page that lets users upload a CSV file. I know there are quite a few forms plugins that do this, but I need the file to be written to a database table. The users ...
0
votes
1answer
13 views

Show a text if the post has written by author user role in Wordpress

I search a PHP code what is show a certain text or html code on the post page when the post author is an author. (not admin or editor) When the post author is an admin or editor then show nothing. ...
0
votes
2answers
26 views

How to access this jQuery/AJAX data in a PHP file/WordPress plugin

I have a jQuery UI sortable list, connected to another list, so far my JavaScript can display the HTML ID's from both of the lists to the screen, but I am having trouble figuring out how to direct ...
0
votes
0answers
13 views

Why WordPress not detect referer when access via Firefox or Safari?

I have a problem when I using XYZ PHPCode Snippets plugin on WordPress. I put the code into the plugin like this: <?php $refer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ...
0
votes
0answers
14 views

Use the fullscreen addon of CodeMirror in the Customizer of WordPress

I would like to use an addon of Codemirror in the customizer of WordPress. I have already register a textarea in the customizer, but how can I use an addon of Codemirror like the fullscreen? https://...
0
votes
1answer
19 views

How to add custom checkout field in user details mail template

I need to add custom field from my checkout page to email templates. I already added custom input at checkout page and it shows up in mails but it shows up after products table and I would like it to ...
1
vote
4answers
26 views

Add a Different CSS Class Into The Body Tag of Different WP Pages

I'm transferring a 20 page static HTML site to a custom Wordpress Theme. On each page of the static site the body tag has a custom CSS class i.e. 'banking-page'. I know that WP generates page id ...
0
votes
1answer
23 views

How to return html as a string from php for WordPress

How to return html as a string from php for WordPress function play_audio($atts){ $a = shortcode_atts( array( 'url' => '' ), $atts ); wp_enqueue_script('player'); ...
0
votes
0answers
9 views

Settings API - registered fields not loaded

I have a problem with my plugin settings page. I've read on wordpress codex how to create an option page for wordpress plugins, I'm able to see the created page, but I'm not able to display the ...
0
votes
0answers
8 views

Set minimum order value only if no coupon applied

I am using a snippet to set minimum order value on WooCommerce store. However, I am having some issues if coupon is applied. For example, minimum order value is 500 and customer applies a coupon with ...
0
votes
1answer
20 views

How to create plugin/ page that reads from database

I am working on a WordPress website. I have a MySQL database with data in it. I want to showcase this data on my website (I already have a local PHP page that does what I want). I have been told that ...
0
votes
0answers
15 views

How to empty price of simple and variable product when product changed into out off stock

I want to empty price of simple product and variable product when product changed into out off stock. I have added one code for that its working well. But when adding this code on my site then when i ...
0
votes
0answers
9 views

Show Gutenberg facebook embed with a custom theme

I'm working on a custom theme, and I would like to display the facebook embed from Gutenberg in Wordpress. I've done parse_blocks and then printing the block displays just the facebook url. // page-...
0
votes
0answers
7 views

How to insert input field on post and validate in PHP using button?

I have the plugin PHP Everywhere activated in my Wordpress installation. I've figured out how to get PHP scripts running on page load (viewing a post) using a Gutenberg Block but now I'd like to run ...
-1
votes
0answers
10 views

Wordpress search based on Categories,Tag,Excerpt,Content and title? [closed]

I am new to WordPress.I am working on home page to implement Search functionality, so it shows all posts,pages based on categories,tags ,excerpt,title and content.I am using divi builder.With divi's ...
0
votes
1answer
30 views

Woocommerce - if selected attribute term equals

I have created an attribute "color" with two terms "black" and "white" and i want to show something when selected term equals to white. I've tried the following code (based on https://stackoverflow....
0
votes
1answer
8 views

Cron job shedules replace?

I was watching this: Wp_Schedule_Event every day at specific time and im wondering if I do the following will it replace all my schedules? function myprefix_custom_cron_schedule( $schedules ) { $...
0
votes
1answer
23 views

How to end a while loop when used in a fetch assoc function [closed]

<?php while($row = $result->fetch_assoc()); ?> <tr> <td><?php echo $row['name']; ?></td> <td><?php echo $row['location']; ?></td> ...
0
votes
0answers
17 views

Display Specific Parent and Child Category Lists with Format

I have a code that I want to display in lists. <nav> <ul class="simplefilter filter-port"> <li class="btn active button btn-hover" data-filter="all">All</li> ...
0
votes
2answers
13 views

How To Post WordPress Custom Post Types to Twitter via IFTTT

I have my wordpress site. Which has the normal "post" and a custom post type "download", I Currently use IFTTT, (If This Then That Service) to post my wordpress posts to Twitter. The IFTTT recipe ...
0
votes
1answer
9 views

split 1 cart item into instock and back ordered

If I have a stock count of 2 and I allow backorders and a client adds a quantity of 5 to the cart, the cart shows 1 line item with a quantity of 5 on backorder. Is there a way to split this cart ...
0
votes
1answer
23 views

Use composer to load custom classes

I want to use composer to load my custom classes inside my plugin. I've tried to use it but without success. Is possible to use compose for the plugin develop to manage custom classes used inside it? ...
0
votes
0answers
19 views

Load script and styles using an array of resources

I want to simplify the scripts and the stylesheet loading in my wordpress plugin. I have this code style now, but I want to implement a best solution, this to encache the function readbility. Is there ...
0
votes
2answers
13 views

Add code to the header of posts by particular author

I want to add CSS code to the header of all the posts by a particular author. I tried the following solution: function hide_author_box() { if (is_author('ritesh')) { ?> <style> ....
-1
votes
0answers
10 views

Add WooCommerce product attributes + translation in WPML

I have followed this approach: https://stackoverflow.com/questions/47518333/create-programmatically-a-variable-product-and-two-new-attributes-in-woocommerce/47844054#47844054 to programmtically ...
0
votes
0answers
10 views

Create WordPress WooCommerce product + translation in WPML programmatically [closed]

I am looking for a way to create a WooCommerce product + a translation programmatically. I have found a way described by WPML on how to do this with posts but if I do it with a Product I get error: "...
-1
votes
0answers
17 views

How to save $_POST['acf']['field_X'] data from a custom form?

I have a User Submitted Posts form in which I've included my ACF field group. $_POST['acf']... includes data submitted via form and with USP filters I can hook into newly created post/article which ...