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
1 answer
24 views

Check if User Meta has Existing Value

Before running a command, I'm trying to check if a user already has a specific value (which is a Post ID) in a user meta key "saved_sessions". (This is a "favorites" type of system ...
Blake Miller's user avatar
1 vote
1 answer
533 views

"Cannot start session when headers already sent" when attempting session

I've read all the similar threads on the Exchange and nothing is resonating. I recently migrated this site from another dedicated server to a new dedicated server. This function, in functions.php, ...
breadwild's user avatar
  • 319
0 votes
1 answer
45 views

Want to add custom post type for facebook feed

I have Facebook api for feeds. I want to add multiple user's Facebook feeds on their page. So, how can I add custom post type for Facebook feeds, which users can login to their account to get feeds ...
Devil mind's user avatar
0 votes
1 answer
35 views

I have issue with decoding json ex. '{"a":"b"}'

Hey I am trying to send JSON data from (WRITE AN EXCERPT (OPTIONAL)) this section. Let say I pass this '{"a":"b"}' as Map now in the wordpress templete I tried to get this so I was ...
waqas023's user avatar
0 votes
1 answer
83 views

Enabling pretty permalinks with Docker, Multisite Wordpress and Caddy

My task is to migrate several existing blogs, which where hosted on individual instances, to a multisite instance. The entire multisite instance is dockerized due to company policy and using "...
Julian Kirsch's user avatar
0 votes
0 answers
158 views

Finding plugin that makes this part of page (finding sweetwinsprizes.info virus's origin)

I have a website with several plugins installed. in 70% of page loading everything is OK and header is something like this: <head> <meta charset="UTF-8"> <link rel=&...
qwerty13's user avatar
0 votes
0 answers
42 views

wp_get_post_terms not working when using AJAX

I am trying to display terms with a load more button on the website, but I have come across a problem while the page loads first the below code works perfectly giving me 4 terms in the correct ...
mjcoder's user avatar
  • 101
2 votes
1 answer
419 views

Can I send a body using wp_remote_get()?

I'm writing a WordPress plugin and want to retrieve data from my API on another domain using wp_remote_get() On this page: https://wp-kama.com/function/wp_remote_get There is a Usage Template: $...
HardlyNoticeable's user avatar
0 votes
1 answer
98 views

Remove H1 title in admin post edit screen

As a priority i need to just display some custom html inside the Title(h1.wp-heading-inline) in the Post Edit Screen (Top Left Corner). While trying various methods i found that all html is filtered ...
Ion T's user avatar
  • 15
0 votes
2 answers
111 views

"acf/load_field" Critical error upon saving/updating WooCommerce products [closed]

I'm trying to prepopulate an ACF field called "upcoming_class_date" using "acf/load_field" but my code snippet returns a critical error upon saving/updating a product in ...
GrumpyCat000's user avatar
0 votes
2 answers
97 views

Exclude first post from wp query

I am building a WordPress website and I want to show post in it. But the problem is that, I want to exclude the first post in query. I have not much knowledge of PHP. So please help me to de this. ...
Ahmed Muneeb's user avatar
0 votes
1 answer
231 views

Registered a REST Route but I’m Getting a 400 Bad Request

I'm new to this so please bare with me. I'm trying to register a REST route to save the dynamically added custom fields of a custom post along with the post when the user clicks the "Update" ...
Samuel Bacay's user avatar
0 votes
0 answers
15 views

Is It Possible to Include Markups Within If Then Else Statements?

I'm trying to add an else statement to an if statement that has a foreach loop. When I added the else statement it just renders a blank page with no error. It used to work before the else statement. ...
Samuel Bacay's user avatar
0 votes
0 answers
18 views

Row loop inside different columns

Help to create a wordpress loop with the row inside different columns from 2 categories
Jobin Jose V's user avatar
-1 votes
1 answer
78 views

I want change custom title in custom wordpress php page

H Guys, I have a page details.php in WordPress which is run like this [domain.com/product-details?id=706494861] And I want to show the product title as in the head. I have a listable WordPress theme. ...
SaMee Ch's user avatar
0 votes
0 answers
7 views

Remove certain attributes for content before hitting wp-json

I want to remove the data-id attribute from the linkChecker component but, it seems like even when it is removed the data being posted to wp-json still maintains the data-id attribute. I understand ...
ARLCode's user avatar
  • 101
0 votes
0 answers
29 views

Can not insert data in database table

I did a form and through a plugin i coded in php, i’d like to insert the result of this form into my wordpress database. But i run into a problem cause nothing is inserted in my database despite the ...
Louis-Emmanuel Metan's user avatar
0 votes
0 answers
109 views

How to pass a file to an API call through WordPress

I want to pass a file to an API call for translation the action of this button of submit still doesn't direct to any page, so should I make this pure PHP or Ajax gonna take a role here? This's the ...
Mostafa Ezzat's user avatar
0 votes
0 answers
16 views

How to sort shop page by a field in another table

I have a wordpress/woocommerce setup for a site that sells mobile phone accessories. On the shop page, I'm using a plugin called YMM where users can use dropdowns to select their phone make/model. ...
Steve's user avatar
  • 1
0 votes
1 answer
122 views

404 Error after URL update

I changed our company domain name and now all i get is a 404 error. I have updated the option table in phpmyadmin as well as updated apache2 conf. Where else do I need to change the info for this to ...
IVMC Peabody's user avatar
0 votes
0 answers
67 views

WordPress install on new server not recognising MariaDB version

Getting the following error on A CentOS server: You cannot install because WordPress 6.0 requires MySQL version 5.0 or higher. You are running version . So it doesn't appear to be picking up the ...
SCMedia's user avatar
0 votes
1 answer
42 views

Fields are not displayed on front end under custom php code in Advanced Custom Fields and Flexible Content field WordPress

I use Advanced Custom Fields WordPress plugin and the Flexible Content fields. So in one of the fields I need to include a php file, so I do it like this: <?php elseif( get_row_layout() == '...
Brgerg30879's user avatar
0 votes
1 answer
112 views

How do I display WooCommerce products in my query to rows of 3?

I have created a WooCommerce search plugin. It fetches products, however it only displays the products as one per row. How can I amend my query to display 3 products per row? Here is the function: ...
SavPhill's user avatar
  • 118
1 vote
2 answers
56 views

How do I replace a logo image that’s hard-coded into a plugin’s logo.php file?

Update: I tried to change the code in the logo.php file to link to a new logo image that's stored in the Media Library. Following is the code I used, but it's not finding the logo file. <h1 id=&...
amber's user avatar
  • 21
0 votes
1 answer
159 views

Does it make sense to sanitize the output of an SVG file?

I'm developing a plugin. In its settings page I want to use SVG icons. This is how I render SVG icons: <div class="svg-wrap"> <?php echo file_get_contents(ABSPATH . 'wp-content/...
Megumi's user avatar
  • 1
0 votes
0 answers
54 views

Can't insert into a database wordpress

i did a form with html and js, and through a plugin in php, i wish i could insert the result of this form into my wordpress database. But i run into multiples problems. One was that wordpress would ...
Louis-Emmanuel Metan's user avatar
0 votes
1 answer
195 views

How to send email verification code for a form?

I'm learning WordPress Development. I have created a very simple form with only one input field for email. On submission I want 5 digit email verification code to be send to that address. If code ...
Frankie's user avatar
  • 11
0 votes
0 answers
112 views

WordPress Register Block with metadata

I am trying to register a block using the metadata from the block.json <?php /** * Plugin Name: FAQ Block * Description: It is using the description from faq-block.php, not from block....
Marzii's user avatar
  • 1
0 votes
1 answer
21 views

<p> Tags being Inserted in html from plugin PHP not passing through the_content

I have an issue where some raw html is getting tags inserted where 'the_content' is not at play. I tried: remove_filter('the_content', 'wpautop'); remove_filter('the_excerpt', 'wpautop'); Already to ...
Mike Grotton's user avatar
0 votes
0 answers
181 views

Validate a custom form with js and php

I would please need help with the following: I have a form in my WP Plugin, that is validated with js, which works fine, Then I want to validate it using php, display the errors on the form and after ...
gladys's user avatar
  • 11
0 votes
1 answer
18 views

Custom plugin doesn't show in admin menu - when code added, displays an empty page

my customer has this plugin: http://www.davmo.software/public/uverova-kalkulacka_v2.zip When installed, it doesn't have a link in the menu in the administration. I changed the $var variable in the '...
Petr Břeň's user avatar
0 votes
0 answers
31 views

Custom plug-in issues

I wrote a custom plug-in (leaderboard plug-in) to work with my existing plug-in (Clan Wars plug-in) on my website (AllClanBattles.com). I want to be able to take all the existing teams on my website ...
user10212870's user avatar
0 votes
1 answer
19 views

How to get posts by a certain author in inner loop using outer loop variable or post title WordPress

I am working on a WordPress site with staff bio pages. At the bottom of the page, I would like to include their most recent blog posts (if they have any). I have an outer loop that pulls the fields ...
Allyson Smith's user avatar
0 votes
1 answer
172 views

Accessing Correct Database to Create REST API Endpoint

So I have multiple databases associated with the database where my wordpress website is hosted. I was wondering if I can access all of said databases with $wpdb or will I need to initiate a connection ...
oin's user avatar
  • 1
0 votes
1 answer
25 views

I want to allow certain file types on dokan upload files

Before we get started, I have tried alloweding "UPLOAD_UNFILTERED_FILES" thing on config.php and i have tried allow different mime type plugins, none of them worked I want to allow .rbxlx, ....
ItsBenny_'s user avatar
0 votes
0 answers
30 views

i have a external api using that i want to login wordpress

function custom_login_authentication($username, $password) { // Set API endpoint URL $url = "https://webapi.barecms.com/api/users/login"; $data = array( 'email' =>...
user232657's user avatar
0 votes
1 answer
51 views

How to edit templates created in the block editor in code / template files not updating

I'm a beginner when it comes to PHP so have been building my page templates in the Block editor editor [appearance > editor]. But I've reached a point where I need to work in PHP/code (to make a ...
j.flame's user avatar
0 votes
1 answer
28 views

Adding caption to all images inside an article

My client has decided he wants to add inside the article body, for each image, the caption below the img tag. I know WordPress has this shortcode built in, but since there are more than 300 articles, ...
Andrei Zamfira's user avatar
0 votes
1 answer
465 views

How to modify default <meta> tags in wp_head()

I am looking to do some on-page SEO, wherein I want to limit the length of Title, Description, and more in my HTML meta tags. Is there anyway I can access metatags already present in wp_head, and ...
Amit Bajar's user avatar
0 votes
1 answer
61 views

Add text below WooCommerce short description if metabox value is true

For WooCommerce I have a custom metabox that sets products to unavailable if ticked. The code below removes the add to cart button if a product is set to unavailable: // Remove add to cart button if ...
Dvaeer's user avatar
  • 619
0 votes
0 answers
290 views

"Unexpected response from server" error when trying to upload any .mp4 file over 100MB

This WordPress site is being hosted by BlueHost (with cPanel). It is running on WP version: 6.2.2, and PHP Version ea-php74. According the the WP's media 'add new' page, the Maximum upload file size ...
SunnyOz's user avatar
  • 165
0 votes
2 answers
188 views

Wordpress @include( 'template-config.php' );

I'm new to WordPress and I'm getting this message on my WordPress website @include( 'template-config.php' ); I can't access my wp-admin page and website either both of them giving me the same page, I ...
alex's user avatar
  • 1
0 votes
1 answer
41 views

ACF number less than comparison not working

I have two ACF fields named as “price” and “reduced_price” now i have another field named as “price_filter” which should be filled with following conditions, If “price” is greater than “reduced_price”...
Shaharyar Afzal's user avatar
0 votes
2 answers
105 views

Is there a hook that I can use when a fatal error occurs?

Ideally I would like to log the user or page that triggers a fatal error so that I can follow up with that person or go directly to the page they were on for testing. My thought is that if there is an ...
Aristocles's user avatar
0 votes
0 answers
33 views

Prevent WP from escaping html on edit posts screen

In /wp-admin/includes/class-wp-posts-list-table there's a snippet of code that strips html from excerpts on the edit posts screen: echo '<span class="protected-post-excerpt">' . ...
lkl's user avatar
  • 107
1 vote
1 answer
119 views

WordPress Block Editor Gutenberg running code inside ! is_admin()

In my functions.php I have some code inside a function that has a if (! is_admin) condition around it. For some reason the code inside this condition is running when I edit a page in the admin. Its ...
Jon's user avatar
  • 351
0 votes
1 answer
400 views

How to use phpspreadsheet reader with $wpdb

I am trying to import an excel file on a webpage with a submit button. As far as I can tell, the only way to do so is to use PhpSpreadsheet. How can one incorporate PhpSpreadsheet with $wpdb and ...
John Lyons's user avatar
0 votes
0 answers
43 views

How to create different templates for woocommerce single-product.php?

I am learning Wordpress development. I have 3 products that I want to add to my woocommerce store. By default woocommerce store comes with a basic template for all products. But I want to make every ...
Frankie's user avatar
  • 11
0 votes
0 answers
18 views

Importing data from excel sheet on webpage rather than from within phpMyAdmin

Has anyone ever been able to upload an excel sheet to phpmyadmin without doing it manually? On a webpage, I have a upload file with a submit button. Is it possible for the submit button to upload all ...
John Lyons's user avatar
0 votes
0 answers
43 views

get_post_meta returns on side but it doesn't return on bottom of admin page

I have added a custom image upload option in custom CPT page and here is the screenshot - The image is showing well in side bar of admin page after updating a post, screenshot- But when I add that ...
Md maniruzzaman Moon's user avatar

1
3 4
5
6 7
209