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
2 views

Custom register page and getting WordPress registration errors

I'm doing a custom login and register page and the login portion has gone smoothly as I can redirect errors back to my custom page because of how wordpress handles this (such as appending the issue to ...
0
votes
0answers
5 views

Meta query to fetch only latest post [on hold]

I know how to use meta query but can't setup query to fetch only one post by it's custom date field.
0
votes
1answer
20 views

Check class_exists before class definition / Doxygen problem

Currently when I create a class for my WordPress, I start the class with if ( ! class_exist( 'class_i_want_create' ) ) : .... class_definition .... endif; But now I want to create a ...
9
votes
1answer
2k views

How can I save a multiple select array with the settings API for a plug-in options page?

I'm thinking this may be more of a problem with my PHP rather than my use of the settings API, but I can't seem to get Wordpress to save an array of data for a multi-select box. The multi-select box ...
0
votes
1answer
5 views

Can't add to time?

What's the best way to add to time()? For example: time() + 5 will return 5, not the current unix timestamp with 5 added to it. Any ideas? Thanks
0
votes
1answer
26 views

Metadata on the WP_Post object

I need to retrieve custom field content from some posts. I'm currently using ACF and get_fields() gives me the result I need, but I'm wondering if it could be done natively. According to both a ...
0
votes
0answers
10 views

Wordpress Answer Validation, Obfuscation issue

I have this issue, where I have made a function on my wordpress website (under Theme Functions.php), which then uses a shortcode to present on the front end. Now, I want to obfuscate the shortcode, as ...
0
votes
0answers
11 views

How do I make comment-reply-button with <span> that takes to comment reply form on click

I do need your help. I'm actually designing my personal blog's theme and I got stuck when I could not code a working comment-reply-button with span element. I know you must be wondering why with a ...
0
votes
1answer
754 views

Replace shortcode in substring

I've created these two functions to toggle between the first paragraph of the content and then everything but the first paragraph so when the user selects 'More' it slides out the article smoothly ...
0
votes
0answers
9 views

php multi value selection can handle two atrribut in one select

i want to ask how to add selection can handle 2 value in one choice example: in data student have 2 attribut id and name in selection box just visual name and if choice any name attribut id will ...
0
votes
3answers
800 views

Add URL parameter to all internal links using a specific theme

I got stuck with some modifications and maybe someone could give me some help. What am I doing I use the multiple theme plugin to switch themes for my WordPress project. To switch between the ...
-2
votes
0answers
14 views

Please how do i build multi- level marketing software with wordpress [on hold]

please how do i build multilevel marketing software with worpress. Im trying to build a networking hierarchy with wordpress but im stock
1
vote
1answer
40 views

How do I create comment-reply-button using <span> element not <a>

I'm currently working to design my first WordPress blog and I got stuck when I came to code comment-reply-button because I want the comment-reply-button to be coded in span element only not a element ...
0
votes
1answer
932 views

Add prefix to link url

I want to add image link on wordpress site which redirect the user to the another page of same url but with different prefix. for example page url is mydomain.com/post1234 when user click the image on ...
1
vote
0answers
18 views

Can an array be used as a meta_query value?

I'm trying to query a custom post type (courses) by grade using WP_Query and Advanced Custom Fields (ACF). Grades (checkboxes) are organized by term (groups). Four grades per term, four terms per ...
0
votes
1answer
23 views

Wordpress mod_rewrite not working on php fpm

Today I tried to change the webserver to php fpm and it is really very fast But there is a very serious problem I found when I installed Wordpress, when I changed the premalink to anything but the ...
0
votes
0answers
15 views

Php find date in meta_value between 2 date ranges

I want to search SQL database using PHP and look for meta_value. The meta_value contains data like this: "FixtureMatch_Id":"391270","Bookmaker":"1Bet","UpdatedDate":"2018-12-14T12:48:57.64"" So ...
-1
votes
1answer
16 views

How to import data including images from excel sheet

need to import data from excel sheet which have thousands of rows including image paths. Is this possible by using any plugin? Is there any other way to do so? Thank You.
0
votes
1answer
2k views

Upload file could not be moved to wp-content/uploads

I know it has been asked over and over again on the internet and i spend hours digging deeper into the web. But the no answer so far. Why we get this error when you upload a file The uploaded file ...
1
vote
2answers
26 views

AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely

I have multiple wp_query's on the same page. Each one of those queries has an AJAX "read more" button at the bottom. The problem I'm finding is that I can only get one to work at a time. Whichever ...
2
votes
2answers
3k views

Wordpress Infinite Scroll without using any plugin

Background information can be skipped. I wanted to use the infinite scrolling option on my Wordpress theme, but I am not well trained in Javascript so I tried this solution: https://wptheming.com/...
0
votes
1answer
3k views

Create new folder and upload files to custom folder via wp_handle_upload

I am using wp_handle_upload to upload files from a theme template file. if ( ! function_exists('wp_handle_upload') ) require_once( ABSPATH . 'wp-admin/includes/file.php' ); $uploadedfile = $_FILES['...
0
votes
0answers
13 views

Add to total price if product is in a specific category

I have 3 categories on my site (small-cars, cars, truck) and each category has a different formula for "extra miles": small cars (1 * field) (2 * field), trucks (2.5 * field). Like the calculation ...
0
votes
1answer
17 views

Add custom attribute to product's HTML to woocommerce cart page

I'm trying to add a data-attribute to WooCommerce's cart page. The cart page populates a table with each row being a product that has been added to the cart. I'm able to add a data attribute into ...
0
votes
2answers
4k views

Use an anchor link to open an iframe inside a Wordpress page

My Question: How do you make an anchor link to an offsite webpage that when clicked opens up the offsite webpage as an iframe that is inside a new Wordpress page where the Wordpress header and footer ...
0
votes
1answer
12 views

Multiple WordPress sites with different theme and plugin sharing the same content

I want run Multiple Wordpress websites with different theme and plugin using one database where the content remains the same in all websites. 1- site.com - Main site 2- siteb.com - Should use site....
1
vote
1answer
25 views

Changing user_nicename

user_nicename has the same value with user_login. I want to change user_nicename value only by using code snippet into functions.php or wp-config.php. Is it possible without using phpmyadmin or any ...
1
vote
2answers
915 views

How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field

I have searched high and low for a solution and couldn't find anything; hopefully someone here more skilled than myself can lend a hand. I have two testimonial videos (from a video custom post type) ...
0
votes
0answers
8 views

Where is php.ini in Windows Server 2016 installation [on hold]

I'm sure this is a ridiculously dumb question, but I have installed PHP (a couple years ago) on a Windows Server 2016 machine, and I can't find the php.ini file. I'm trying to change the ...
44
votes
6answers
45k views

How to get WordPress Time Zone setting?

Can someone tell me how to get the time zone that is set in the WordPress Admin? For example, if the blog is set to Eastern time, I need this exact string to print out: US/Eastern This is for a ...
1
vote
1answer
3k views

subdirectory index.php is not working

I have setup wordpress in the root directory and at the same level I have some other directories e.g named "sq". Under sq there are subdirectories like first, second, ... under each subdirectory ...
-2
votes
0answers
10 views

Please provide me code for update select query with for WordPress. I want to use with $wpdb [on hold]

Please provide me code for update select query with for WordPress. I want to use with $wpdb nd data how can i store data in db How i can embeded these code in my wordpress php file
0
votes
0answers
14 views

Change WooCommerce template for PDF - access to custom field

I want to do some modifications to a template of WooCommerce, but I'm rather ZERO in PHP, so that is why I'm asking some guidance so I could perform my small modifications, which I'm sure are not too ...
0
votes
1answer
11 views

Using Wordpress custom post type to display StoryMapJS

So I want to use StoryMapJs on my website, and I want to be able to manage these via a custom post type. I've created a custom post type and fields for each option, but I'm struggling to get them to ...
0
votes
1answer
19 views

Allow user to choose header style

I am working on developing a simple WP theme that our office will use as a starting point for any future projects that come in. My question is this: How would I go about adding functionality that ...
0
votes
0answers
17 views

Function not updating user_meta correctly when $current_time triggers

Hi all, I'm having trouble with my logic for the following function. I cant seem to make it work when it is supposed to, and how to override it when it is authorised to. The aim of the function is: -...
0
votes
0answers
18 views

Error on Wordpress site: “an error occurred while processing this directive”. Have debug.log output available

Hope someone might be able to shed some light on this one. The error is very generic and seems quite unpredictable. Happens on some page loads, not others, and when it does, if you refresh a few times,...
0
votes
1answer
800 views

Woocommerce product download URL

I'm making a skin for The Grid plugin (https://theme-one.com/docs/the-grid/#developer_guide). All the products are virtual and downloadable — I've managed to make an add to cart function, but need to ...
2
votes
1answer
80 views

Action 'save_post' not working for quick edit

I have read other answers to similar questions but none of them solved my problem. This code works great in Editor but on Quick Edit or Bulk Edit it does not appear to fire at all. What am I doing ...
0
votes
1answer
1k views

Add a custom class to the body tag using custom fields

There are certain posts where I want to manually append a custom body class using custom fields. How do I go about it appending the class to the body tag when a certain custom field is added to a ...
0
votes
0answers
14 views

function to generate custom field for Mailster newsletter from WPgens referral code

I’m quite new to WordPress – and coding in general except I did a lot of SQL, R Matlab etc during my studies a long time ago so I can learn if I know where to search :-). But php, javascript etc are ...
0
votes
0answers
7 views

WooCommerce: How can I select the catalog_visibility for a product?

I know, as simple as it sounds but I don't get it running: How can I select the product visibility for a product by his id via SQL? This is what I have: global $wpdb; $result = $wpdb->get_col( "...
0
votes
0answers
17 views

Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment

I'm looking for some advice in regards to how I approach dealing with a redirected URL with params. I have a client, let's say Client #A. They have a WordPress website we previously created with ...
0
votes
1answer
945 views

How to remove html comment from source?

Is any easy method to remove all html comment like <!-- wp_head()--> from source from every pages and posts? Maybe using functions.php? Is any easy method without plugin?
0
votes
2answers
16 views

Anyway to output the registration form like the login form with wp_login_form()?

I'm trying to create a dual login/register page with WordPress and so far I found out I can create my custom template and then output the login form with wp_login_form, however I cannot find any ...
0
votes
2answers
993 views

Creating customized php files in theme folder

I am developing a e-commerce theme that requires an order page. I created a php file inside my theme folder named order-page.php and hope to access this page from the wordpress root url (example.com/...
0
votes
1answer
949 views

How to solve 404 permalink errors on nginx server

I can't solve this issue. I tried everything I found over the web. I first tried configuring my nginx.conf following the example on codex with no success. https://codex.wordpress.org/Nginx I found ...
1
vote
2answers
30 views

Self deactivate plugins after an action occurs

I'm developing a WordPress plugin. I want to download a file from a server, then unzip and put it inside the main directory of WordPress after the plugin is activated. The process of download and ...
2
votes
1answer
778 views

how to update and display an option without reloading the page

Hello I have a select box in which when one item is selected a update_option event fires and get's the selected item's value and echo's it on the page without having to reloading the page. I've put a ...
0
votes
2answers
12 views

How to make this code valid only when the value exists?

very new here to php and wordpress coding (1 day lol). This is my code so far, the problem is that when there is no value assigned to this attribute I receive and error message. I know I need ...