Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [php]

The server-side programming language that the WordPress core, plugins and themes are written in.

0
votes
0answers
8 views

Can't successfully check if post with title exist in database

In WordPress, I am trying to import posts from a CSV file. I want to check, if post with title already exist. I am trying to do this using a database query, but I am still able to import the same ...
0
votes
1answer
14 views

image on homepage disappeared due to change of permalink name

where to do this in Wordpress backend? I need to add the missing icons for "Smart living" and "Smart workspace" on homepage section - image is not in available in Media - It is in a section of the ...
0
votes
0answers
11 views

Woocommerce: Update SKU after add to cart button

Some products have the standard SKU (inventory) field from woocommerce (SKU1) and an extra SKU (sku2) custom field. I added a mandatory selection box: "With barcode", "without barcode", if the user ...
0
votes
0answers
9 views

In Container.php line 767: Class request does not exist [on hold]

In Container.php line 767: Class request does not exist In Laravel.log [2019-01-17 17:20:24] production.ERROR: Class request does not exist {"exception":"[object] (ReflectionException(code: -1): ...
-1
votes
0answers
12 views

Wordpress pages - artists, event, releases [on hold]

I want to build a website like this. It should feature artists, events and releases. The linked site is using wordpress too, but I cant find the plugins or how to achieve this "link" to each category. ...
0
votes
1answer
22 views

Is it best to avoid using $wpdb for security issues?

I'm using WordPress Multisite with multilingualpress. In order to get the href, outside of my navbar, to the page with the appropriate language, I am using an SQL query that queries $wpdb within the ...
0
votes
1answer
17 views

PHP error after theme update

I just updated my theme and I'm having errors on the homepage, the elements of the visual composer do not appear, and I get a php error. Undefined index: focus in /inc/admin/option-tree/ot-...
0
votes
0answers
11 views

Filtering Woocommerce Product Tag Cloud in Product Edit Admin

Hello I was researching google to find a way to organize the product tags that appear in the "Choose from the most used tags" box when adding New Products to Wordpress WooCommerce Product admin. ...
0
votes
1answer
14 views

Wordpress Post undefined error with Post Date (New to Wordpres Dev)

I'm getting an error on a new page with the current Date posted Notice : Undefined index: ama_text_field_01_2019 on line 57 http://magazine.americanmotorcyclist.com/6607/quest-completed/ When I ...
1
vote
1answer
34 views

Renaming post IDs - Okay to do?

Is it possible to change the post IDs within the wp_posts table without causing problems? I ask this because I have a WordPress Multisite in which I separate the sites by language. Unfortunately, the ...
0
votes
1answer
22 views

CPT in a shortcode

I'm having trouble with putting my custom post type content in the shortcode and was wondering can someone help me with this. I need this in shortcode: // List judges shortcode function ...
-2
votes
0answers
17 views

Display Current Time using shortcode

I am using the below code to display current time in php supported time zones: <?php date_default_timezone_set('Asia/Kolkata'); $currentTime = date( 'd-m-Y h:i:s A', time () ); echo $currentTime; ...
0
votes
0answers
18 views

Dynamic CSS styles with ACF

I'm playing around with ACF to try to create my own rudimentary page-builder. One thing I'm trying to accomplish is using it with Gutenberg to create somewhat of a WYSIWYG. I'm not sure the best ...
0
votes
0answers
4 views

How do i updated auto generate password into the database using custom function into the function.php

How do i updated auto generate password into the database using custom function into the function.php? Currently function updated auto generate password into the database but problem is that unable to ...
0
votes
0answers
17 views

How to create a WP_Query to search the Title or Tag?

I have created a search using WP_Query, it seems like this query is looking for the queried term in title AND tags. Is there a way to have this search the title OR tags? $s = $request['s']; $tags = ...
-1
votes
0answers
8 views

woocommerce charge later another price [on hold]

I'm developing for my client a wooocommerce site that is selling meat. the problem is that When somebody buys 1 kg meat they never get exactly 1kg. It's for example 1kg 200gram. So I sell the ...
0
votes
0answers
11 views

Cant connect to database with php 7.3

when i update my site from php 5.6 => 7.3.0 . i recviced this error 'Error establishing a database connection'.. But when i downgrade php to 5.6 , my website work fine . Anyone know this issue . this ...
0
votes
0answers
18 views

Deprecated errors in my browser

can anyone help me with these errors. My website is www.theme30.com Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /home/theme30/public_html/wp-includes/compat.php on ...
0
votes
0answers
19 views

file_exists() Not Finding Image Path [on hold]

I am attempting to use a condition, where if a picture exists, to use that one, otherwise use a default one on a Wordpress.com hosted site, so I do not have access to the background files/permissions. ...
0
votes
0answers
23 views

Cleaner 'for each' loop for registering scripts in functions.php

I'm looking for a elegant way to register a ton of scripts I have sitting in a js directory on my server without having to sit and type them all out. I found this question here but it is 3 years ...
0
votes
0answers
15 views

WooCommerce Product save() function returns php notice: Trying to get property 'name' of non-object

I can't figure this one out. I've written the following function which updates the stock quantity of a particular item: public function update_stock( $sku, $quantity ) { $id = $this->...
1
vote
1answer
45 views

Same log message keeps on printing to debug.log file thousand of times

So i was debugging my PHP code while working with Wordpress site by writing to debug.log with error_log($message) or trigger_error($message). My message in these log statements keeps on printing ...
0
votes
1answer
14 views

Set a cookie inside the 404.php theme page

I'm trying to set a cookie with these code but the cookie is not created setcookie( 'name', 'carl', 0, '/names', 'https://my.webdomain.com', isset($_SERVER["HTTPS"]), true); I was looking on the ...
0
votes
2answers
20 views

WP + MySql db / PHP

I have a website running WP connected to a MySql db, where the latter uses PHP. I did not make the site and have only small experience with WP. This may be a simple question. The WP also uses ...
0
votes
0answers
15 views

Bifurcate woocommerce cart plugin in two parts

[woocommerce_cart] The above shortcode renders the woocommerce cart page, which will have these looks: What if we want just to generate just Part 1 or Part 2 as shown in the figure. Is that ...
1
vote
2answers
31 views

tracking number field in Woocommerce order [on hold]

I am creating a custom field Tracking_ID on Woocommerce, where the admin will enter the tracking ID as value. How can i get the value of the created custom field and display it inside the customer-...
0
votes
1answer
16 views

Is it possible to use array_walk() to append terms to an array of posts?

I'm creating a masonry post grid of animals. I plan to filter the the visible posts by toggling classes. The classes would in turn would be the post's. I'm using an MVC theme and would like to get ...
0
votes
0answers
25 views

How to have multiple the_content() tags

I am designing a wordpress blog where you click on the title of the post and the content of the post opens up from the right side of the website. I was wondering if it was possible to have multiple ...
0
votes
1answer
14 views

Prevent publish status/date saved on transition_post_status hook

I'm using the transition_post_status to prevent a custom post type from being published based on a post meta field. It doesn't seem to work entirely, and that's where I need some help. Here is a ...
0
votes
1answer
19 views

Premature end of script headers: wp-mail.php?

I haven't edited wp-mail.php at all. I'm using the default WordPress file. I'm trying the whole submit post by email function that we know in settings (using gmail and pop3, if that's relevant). I ...
0
votes
1answer
25 views

Move Jquery.js to Footer

I want to move jquery.js from header to footer. I have tried following code: //Remove jQuery Default function replace_jquery() { if (!is_admin()) { wp_deregister_script('jquery'); } } ...
0
votes
0answers
13 views

403 Forbidden Wordpress Database Results

I have a website, hosted on Wordpress. I have created a custom table within the WPDB, with ARI Adminer, called 'people'. I have entered some entries for testing. I have created a test page with the ...
0
votes
0answers
14 views

Convert PHP/Javascript to Widget

I'm going to preface this by saying I am new to Wordpress development, and have never had to use AJAX or JQuery, which if what I have read is correct, this should be able to be accomplished with. The ...
0
votes
0answers
24 views

Posts in two different columns Bootstrap

I want the posts on the main page to be arranged in Bootstrap columns in this way: I have this code, but instead of the first two posts, only one is displayed. <?php get_header(); ?> <?php $...
0
votes
2answers
17 views

How can I fix the mixed content problems of the kk star ratings plugin?

I recently switched to ssl in order to provide a better and more secure website experience for my users. I nearly solved all of my mixed content issues, but the mixed content warnings of the ...
0
votes
1answer
17 views

How best to check if a user is from China and hide content?

To speed up my website in China I thought of hiding blocked services from Chinese users and wrote this and put it in functions.php $isInChina = false; $ip = $_SERVER['REMOTE_ADDR']; // This will ...
0
votes
1answer
18 views

Add HTML before a specific div?

I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox. So I got the idea to add an image with some ...
1
vote
1answer
18 views

How to store post ID's in cookie or session to display the same posts later

I run a wp_query that fetches 4 posts from db with rand() and displays them in a grid to visitors. What I need is to display the exact same posts the query fetched the first time, a second time to ...
0
votes
0answers
21 views

Updating the database after parsing CSV document

Im trying to update the database based in a CSV document, if the first value in the CVS row is equal or greater than 300, it should update the database, and so on....but I cant get it to work, the ...
0
votes
0answers
21 views

Append query string to all URL's

A user will be directed from a website to a landing page that will have a query string in the URL i.e. www.sitename.com?foo=bar&bar=foo. What I want to do, is then append that query string to all ...
1
vote
0answers
6 views

Wordpress can't find temporary folder, but folder it's looking at has correct permissions

So, I've spent a couple of hours looking around the internet to try to figure out this problem, since it seems like a dumb one that would probably be a duplicate, but apparently it isn't. I'm hosting ...
1
vote
2answers
54 views

Display FNumber (aperture) as a number versus a fraction

I'm a newbie at even trying to work with PHP, but thinking there may be a simple solution to this. EXIF exposure data is only displaying an "s", so there must be an error. I'd also like to display ...
1
vote
1answer
45 views

Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?

I have been follow a tutorial here: https://rudrastyh.com/gutenberg/remove-default-blocks.html Where it discusses how to remove default Gutenberg blocks like so: add_filter( 'allowed_block_types', '...
0
votes
0answers
14 views

Re-Use WordPress Admin Tag/Category Selector

I want to re-use the frontend tag/category selector that is used when editing a post in the WordPress Admin. I have my own data API that I want this to connect to, rather than searching for tags/...
0
votes
1answer
27 views

Correct way to make static pages editable in wordpress

I am in the process of converting a small static website with 5 pages into a WordPress site. I have created a custom theme and created the pages (Home, About Us etc) from the Wp backend. I have ...
0
votes
0answers
9 views

Redeclare / override WooCommerce core function

So, I am adding my own drop downs on the shipping section in the checkout of woocommerce. They will filter the options via jquery to only show and hide the valid options of the user (they have to pick ...
0
votes
2answers
20 views

CSS change in woo commerce Place Order Text [closed]

add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' ); function woo_custom_order_button_text() { return __( 'Your new button text here', 'woocommerce' ); } Above is the ...
0
votes
0answers
6 views

Get Woocommerce $email->id inside file a file email-order-items.php

I'm customizing some woocommrce files, which need to get woocommrce $email->id, i checked on main email templates like customer-completed-order.php which have $email object but in email-order-items....
0
votes
0answers
15 views

How do I implement a check for correct answer of question on specific page?

I have multiple Woocommerce product pages which would only allow users who had answered a question correctly to view. Each product page would have their own question and should be treated separately. ...
0
votes
0answers
27 views

How to send the whole page as a mail in wordpress

I have created my custom form using php , but above the custom form there are some fields which are manually grayed out. I want to attach a wp_mail to both the grayed out fields as well as the custom ...