Stack Exchange Network

Stack Exchange network consists of 175 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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

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.

0
votes
1answer
8 views

HTML tags in bloginfo description

I'm trying to set some <span> tags in the bloginfo description. So I put this in the blog description field: <span class="name">Archive | Navarro Vives</span> <span>is a point ...
0
votes
2answers
15 views

Custom post type category not displaying category ID

I'm trying to get the category ID so I can call a loop query on only that category ID. However the following code returns null. Any ideas why? In the admin bar it shows edit category with an ID of 3, ...
0
votes
0answers
6 views

Redirect user after form submit alert message

I need to display a javascript alert after a form submission and then redirect the user to the home. I have this code, but it will always redirect the user to the wp-admin/admin-post.php page. How I ...
0
votes
1answer
32 views

How do I wrap this?

I have snipped of PHP code I'd like to have wrapped within its php-file with the do_shortcode function. Unfortunatly, I don't have clue how to do this. Several ways I tried end in an error on the page....
1
vote
1answer
16 views

Which field should I edit to make the checkbox marked by default?

I have a php form that I want to change the state of a checkbox so it's filled by default, but there are two fields that may be the right way: 'request_vendor_access' => array( '...
0
votes
0answers
9 views

Why ImageMagick doesn't work? [on hold]

Last version Wp, clean setup, php.ini => extension=imagick.so exists. Why doesn't it work? add_filter( 'wp_image_editors', 'select_wp_image_editors' ); function select_wp_image_editors( $editors ) { ...
0
votes
1answer
16 views

Get first URL from post content

Basically all I want to do is if the post format is "link" rather than link to the post from the blog index, link to the link pasted within the post content. In my index.php I have: <h3> <...
0
votes
0answers
13 views

I want my category (archive) pages to mimic the structure/style of my Posts (home) page

Theme I'm using is easymag-pro. I will paste both pages below. I know I have to replace the archive.php with my home.php, but I need to add something to the new archive page so it will pull the posts ...
1
vote
1answer
21 views

Display a selected custom product option in WooCommerce cart

I am using the code below to display a custom select field on WooCommerce single product pages: <?php $sizes = $product->get_attribute( 'size' ); $sizes = explode(", ",$sizes); ?> <?php ...
-1
votes
1answer
16 views

how do integration Carousel on Wordpress?

Get help from you how to place Carousel in this code that I have now: <div class="black"> <section class="t-grid-11"> <div class="t-grid-i"> <div class="t-grid-i-i"> <...
0
votes
0answers
7 views

503 Server Error Code [on hold]

Hi I would like to ask regarding my error I get. The problem solve after I increse the MAX_EXECUTION_TIME & MEMORY LIMIT . But after a few days the problum occur again which I need to increase and ...
0
votes
1answer
28 views

Return author name as a tag using get_author

I'm trying to display the author name as a tag. I looked at many forums and it's referring to the get_author methods and the PHP files from the template PHP. However, I do not know what changes to ...
0
votes
0answers
11 views

How to save and retreive an array from checkbox list in Theme Options [on hold]

I am developing a very simple WP theme and I wonder how could I get this functioning. The main goal is to save the value of the selected checkboxes and retreive it in the front-end footer to load the ...
2
votes
1answer
27 views

Get WooCommerce product details and transfer them to a custom DB table

I'm currently doing a registering service for products with WordPress and WooCommerce. All products that customers can register will be in the WooCommerce database, but not visible on frontend. Here ...
-1
votes
0answers
20 views

How to know find the input id for use it on wp_insert_post

I made wp plugin for automatic posting require 'crawel.php'; if (isset($_POST['activated']) && is_admin()){ $new_page_title = $manga_name; $...
0
votes
1answer
19 views

How to add a new column with text fields to WooCommerce Cart List?

As attached images. How to add a new column with text fields to WooCommerce Cart List? Thanks.
0
votes
0answers
11 views

Is it possible to create a toggle session() using <a> tag or button [on hold]

I have an intention to create a toggle button in my web page.Usually, I am using GET_ method. But, just for an excitement, Is it possible to create a toggle session() using a single <a> tag or ...
0
votes
0answers
47 views

Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?

I'm currently using a plugin that generates a PDF for customers but the URL is way too long. For eg - https://www.mywebsite.com/wp-content/uploads/pdfuploads/666666.pdf. Here's the specific code from ...
-1
votes
0answers
15 views

How do I make a div a specific size when doing an image gallery?

I am making a new custom plugin for my WordPress site that displays an image gallery using the shortcode: [galleryplugin] The plugin uses PHP and JavaScript. Essentially I want the shortcode to ...
0
votes
2answers
24 views

Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test

I've been trying to grasp AJAX for the past 12 hours and i'm slowly losing it. How can I simply pass two basic input dates via form or any other means, not refresh the page, and have it execute the ...
0
votes
0answers
25 views

Ajax load more posts with Ajax taxonomy filter

I'm trying to create taxonomy filter with Ajax load more posts, everything is working except the first page on my template! I have a custom template page for taxonomy downloads as below the load ...
0
votes
0answers
13 views

How can I add links to posts and pages using a particular image from its own media attachment page?

I have various media attachment pages e.g. https://www.artobatours.com/rock-art-abric-del-mas-den-ramon-den-besso-muntanyes-de-prades-catalonia/ where I have the image and some exif data. Along with ...
1
vote
1answer
16 views

Make specific products accessible only to a user role in WooCommerce

I am making a plugin to hide specific product category only for a user role. add_action( 'woocommerce_product_query', 'wcpp_hide_product' ); function wcpp_hide_product( $q ) { //if main query, ...
0
votes
0answers
22 views

How do I edit the text in this function.php file?

How do I change the text "This comment was edited." in this function.php? <?php if ($edit_comment == "edited") {?> <em class="comment-edited"> <?php if (isset($its_question) &&...
2
votes
1answer
17 views

Get product attribute for Simple product in WooCommerce

I need to get product attributes from product in WooCommerce, type product Simple product, some product can be as dropdown, but much options as radio button. How I can do this? How it possible? ...
0
votes
0answers
8 views

Apply a different filer and parse the entire document instead of just the_content

Good morning, I'm trying to modify a plugin, to lazy load my images (a3 lazy load). The problem is that this plugin is returning only the images in the content, but for some reason when we created ...
0
votes
1answer
16 views

Exclude posts with specific metadata from search?

I have created this searchfunction that looks like this: function search_data_fetch() { $search_query = new WP_Query( array( 'posts_per_page' => -1, 's' => esc_attr( $_POST['keyword'] ), '...
0
votes
1answer
10 views

How to pull date/time in french format for wordpress post?

I am working on a wordpress post in which I want the date/time in frech format as shown below: ENGLISH By FJ Published April 9, 2019 at 4:05 p.m. Last updated April 9, 2019 at 4:14 p.m. FRENCH Un ...
1
vote
1answer
21 views

Query WooCommerce orders grouped by several order statuses

As I can see from WooCommerce documentation, WC_Order_Query allows only one single order status to be passed as query parameter. Has anyone find some workaround to allow querying several order ...
0
votes
0answers
8 views

how can i get previous $_GET? [duplicate]

i want to save previous $_GET and get it in the next refresh. then use it to see if it has been changed or not. i want to do it because is i change may form and go to next page, in the next page it ...
0
votes
0answers
13 views

Make price field required in admin WooCommerce [closed]

How to make price field required in admin WooCommerce?
0
votes
1answer
26 views

Call to undefined function get_userdata() in plugin

After refactoring/restructuring files in my plug-in, I now get the error Uncaught Error: Call to undefined function get_userdata() after code $current_user_id = get_current_user_id(); $...
1
vote
1answer
14 views

Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products

So, like the title says, I am looking for a way to override the setting that makes a products that is out of stock not purchasable. I know I am supposed to use the "allow on backorder" setting to do ...
1
vote
2answers
30 views

Missing Author Information

I am having trouble displaying the author name and avatar on my single.php page. The posts load fine and all the correct information is available. However the avatar and name is no where to be found. ...
0
votes
2answers
17 views

Path for php file for inserting data through html form

I have a HTML form which inserts data into a custom table. The code for inserting the data is in a PHP file . My question is where do I place the PHP file in the WordPress filesystem? I have tried ...
-1
votes
0answers
12 views

Multiple changes to PHP files [closed]

Please excuse the naivety of this question... I have received the log file (From Sucuri) of changes that have been made to PHP files on my WP site. Having looked at it, I was wondered why I have ...
0
votes
0answers
13 views

How to properly add custom product meta to order meta in woocommerce

I have the code to add some custom product meta data to cart and then later pass them to order meta. Everything works fine but it feels like the add to cart process is quite slow which makes me wonder ...
1
vote
0answers
18 views

Add filter when image is uploaded?

I'm trying to use this code from another SO resopnse: function ajx_sharpen_resized_files( $resized_file ) { $image = wp_load_image( $resized_file ); if ( !is_resource( $image ) ) ...
0
votes
0answers
9 views

Filter for widget media image

There is a filter for "widget_media_image"? I'm trying to add new attributes using preg_replace but i can't find the correct filter for this widget.
0
votes
1answer
35 views

change title page on search result

I want to change in my search result the title. Unfortunately I don't have option to change this in , because I must do it in plugin file. Actually I have that code in PHP file: if (isset($_GET['...
1
vote
4answers
237 views

get_users(…) only returns one user

I have an array of user IDs, I want to get data for each of these users. I first thought of writing a classic SQL query but I found WordPress has integreted functions for it. However, get_users(...) ...
0
votes
0answers
16 views

pagination problem with select option

I have a select option menu and a wp_query. when a user choose an option, it shows related posts. everything is great but pagination. pagination is working good, it shows pages and when you click page ...
0
votes
2answers
33 views

How to turn off email you receive when registered?

My client wants to turn off the email you receive when register.
0
votes
0answers
21 views

Looping over an array of URL end points

Hey guys thanks in advance to all, So Iv made a conditional statement for a plugin that runs on woocommerce, to target the URL so I can inject custom css via php or whatever. the code works fine, but ...
0
votes
0answers
13 views

Cannot transfer ajax post data from js to php file

I need to click on the button to send some data to the php file and update the user's balance in the database. quotes.js Part of the code: var data = { sell: sell_current_quote, buy: ...
0
votes
1answer
14 views

Displaying Woocommerce Product Category in Wordpress

I'm trying to create a custom theme. I added theme compatibility with Woocommerce to my theme, and am trying to create a product loop. I want to filter my loop so it only displays post with the ...
1
vote
0answers
19 views

How to debug my custom login form looping intermittently

I have a custom log in form for users of my website where they can log in then view some information that related to them. The problem is sometimes this form will loop. I will get the message "login ...
0
votes
1answer
28 views

Save user total active time after login in wordpress [closed]

I want to calculate the total active time of the user after user login in wordpress site. For this i am using the following hook in my custom plugin: add_action('wp_login', 'save_login_time', 10, 2)...
-2
votes
1answer
36 views

How to insert the first letter in uppercase [closed]

short question, I have a variable concatenated with a get_the_title and get_the_category, and I need the get_the_category to show the first letter in capital letters. <?php echo get_the_title().' ...
0
votes
0answers
21 views

JQuery modal not loading video on popup, only displaying it after multiple reopenings

I am trying to load a PHP function into a modal, containing a video. I'm currently using jquerymodal.com's plugin to achieve that. Here's the current .js code I'm using: https://jmp.sh/v/...