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.
10,559
questions
1
vote
0
answers
25
views
Trying to insert widget code into theme function
The site I am working on has a function in the theme (Botiga) that creates a wrapper row that displays a sorting dropdown for the items below. The default output is the dropdown displays in the right ...
0
votes
0
answers
18
views
Access wordpress blog on subdirectory /blog that is running on subdomain
I have my main site https://1example.com in nextjs and wordpress blog on subdomain https://blog.1example.com. They both are hosted on different servers and diff hostings.
I need my blog to be ...
0
votes
0
answers
46
views
Wordpress blog header error
I got this problem after I updated the PHP version on the host and I can't figure out why it happened. Also, from time to time, it gets magically fixed.
/**
* Front to the WordPress application. This ...
1
vote
0
answers
62
views
WP rest api and litespeed incompatibility
I have tried everything i could think of and searched on the on Internet for the last few days i'm spending ~10 hours per day trying to diagnose this.
the issue:
in WP Site Health i get:
The REST ...
0
votes
1
answer
39
views
How to print the value in same page using php template
I want to display the value entered in the form field in the same page. I have created custom php template for the page. Its showing 404 when I submit. Please help how to achieve this.
<table>
&...
1
vote
0
answers
11
views
Add More Featured Data Not Sending to Database
I have made one form which is two step based. also i have added feature add more. So when you add click show same filed duplicate on step two.
Problem----
When i'm trying to send data by (add more) ...
0
votes
1
answer
19
views
Why plugins can't add(inject) their code in my comments?
I'm using a custom template for my wordpress comments. I can't figure out why plugins like dislike/like comments can't add their code to my comments content. Same for rating, if users choose let's say ...
0
votes
0
answers
16
views
Conclude woocommerce-shipping-totals
I use a Plugin for my woocommerce Checkout (Fluid Checkout). I use different shipping Methods for different products. In this case I got for each Method one output in the checkout shipping totals.
But ...
1
vote
1
answer
10
views
Get check box values inside array for use in posting form data
So I have the following function with an array of variables that handles a profile form.
All but one is a typical input with the exception of 'member-comptency[]'. It's a select field field with ...
0
votes
1
answer
37
views
WordPress move current to top in the loop
I have this code to loop coupon codes in store page.
Current coupons open in same page of store page.
I want move the current coupon to top of loop.
<?php
while ( have_posts() ) {
the_post();
...
0
votes
0
answers
36
views
Advanced Custom Fields Auto Populating Field Values For Nested Repeater FIelds
So we have configured a filter to automatically populate ACF Fields from a custom post type and we have this working for a top-level flexible content block. However, we don't seem to be able to do the ...
0
votes
0
answers
21
views
How to change product SKU's in bulk with a plugin
Hey guys I have a Woo store where pretty much all my SKUs are wrong. I am trying to create a plugin to update all the SKU's in bulk but it is not working as should. Here is the code snippet:
<?php
...
2
votes
0
answers
48
views
Can't find elemnts on the DOM using Custom Control in Customizer API
I'am creating a Custom Control on Customizer API, I add Multiple Checkbox as my custom type.
When I wanna add a live preview, the jQuery doesn't find the selector that I want.
Here's functions.php ...
0
votes
1
answer
66
views
Advanced Custom Fields - How do I get field values of a group within a group field type
I'm creating a Run Report page for a ski resort. I have created an ACF group calls Runs. Within this ACF group there are a number of ski runs that use the checkbox field with the values 'Day' 'Night' ...
0
votes
0
answers
42
views
NGINX rewrite rules for Wordpress Subdirectory Multisite to support deep URL
I'm trying to setup a Wordpress Subdirectory multisite that can support deep urls. By deep urls, I mean the the sites should be able to have more nested parts. E.g
https://example.com/path/nested/...
0
votes
2
answers
35
views
Count post with tags within one category?
I have a code that counts how many posts I have in with certain tags, is it possible to add the functions to count how many posts I have with a certain tag that's in a particularly category called &...
1
vote
0
answers
30
views
Will php code slow down site?
I have a code, that counts total posts (in certain categories);
<?php
$term_slugs = [ 'cat', 'bird', 'chinchilla','dog','ferret','hamster','horse','lizard','mouse','pig','poultry','rabbit','snake','...
0
votes
0
answers
11
views
How can I eliminate the top-level URL slug in WordPress while still being able to access child pages, particularly three levels deep or more?
Is this a limitation inherent to WordPress? For instance, when we have a URL structure with three levels of hierarchy, is it not possible to remove the first level? Currently, I must maintain the ...
1
vote
0
answers
12
views
WP Bootstrap NavWaker: Dropdown Menu Opens All Dropdown Menus at Once
I'm having difficulty implementing a dropdown menu with Bootstrap and WordPress. I've used filters to add the 'dropdown-toggle-split' class to the link elements of menu items that have submenus. ...
0
votes
0
answers
18
views
BrowserSync not detecting PHP files in WordPress + Laravel Mix
I've been trying to set up BrowserSync for my WordPress theme running locally with Local by Flywheel. Basically I followed this guide: https://fraserclark.com/blog/laravel-mix-with-wordpress
However, ...
1
vote
0
answers
69
views
Extracting and Replacing HTML Post content with PHP DOM
I'm working on updating/replacing certain data in WordPress blog posts(1000+) from 2 categories from which I need to extract specific HTML content from two p tags and replace one of the p tags with ...
0
votes
1
answer
22
views
Creating an array with gettexed terms
In my search-box function I have this piece
$select = $wp_query->get('tipologia');
$select = '' == $select ? 0 : $select;
$taxonomy = wp_dropdown_categories([
'hierarchical' => false,
'...
0
votes
1
answer
39
views
How to make my scroll bar show under condition
I am using WP/code snippet with my wordpress website (here still on localhost) and I have a scroll bar that I want to show only when we add the text that will contain this scrollbar at the top. I have ...
0
votes
1
answer
23
views
counting slugs not working?
I'm trying to restart a site from 2020, and I have a counter that counts how many "cats" i have as tags, and how many of them that are listed to be allowed.
So I have a tag "cat" ...
-1
votes
1
answer
26
views
How to insert crm php code in wordpress?
I want to insert crm integrations php code in Wordpress but not understanding where to insert & how to get the data in crm
0
votes
0
answers
12
views
Function for Post Creation plugin for Gravity Forms
add_action('gform_after_submission_33', 'customize_submission_values_for_custom_post_type', 10, 2);
function customize_submission_values_for_custom_post_type($entry, $form) {
if ($form['id'] != ...
0
votes
0
answers
28
views
Hot to show custom post type taxonomies on archive page
I have a custom port type 'apartments' and each apartment has several parametres which I made into custom taxonomies, like 'number of rooms', 'area', 'region', 'status', etc.
The task is to show all ...
0
votes
0
answers
19
views
How to access admin menu labels and links on front-end?
I am trying to retrieve a list of all the admin menu labels and links on the front-end so I can add them to my admin bar menu. I don't need the submenus. I was hoping to access global $menu, but it ...
0
votes
0
answers
33
views
success Message not Displaying
I have made one form on WP-admin side when i approved and reject the form working well but not sure why I'm not able to show my success Message on right place.
if i echo it working well but not right ...
0
votes
0
answers
21
views
wordpress-plugin (widget) that performs a Neaby-search on the openstreetmap-endpoint: around x find y
i am about to create a wordpress-plugin that offers the output of the following data ...
the data of a a Neaby-search:
can we create a quewry that shows up all the schools that are in the near - in ...
0
votes
0
answers
20
views
Integrate a Custom Post Type with Learndash Plugin
I've registered a custom post type already in wordpress. I am looking for a solution to display that custom post type in learndash course Hierarchy.
0
votes
0
answers
20
views
How to create advanced custom fields for backend content
Is there a straightforward way to create custom fields for module-based content on WordPress?
Example:
User Creates page
Creates Page content sections through forms
Row 1: Column 1 - Content A ...
0
votes
0
answers
9
views
child category under correct parent
I have a side bar that is showing my custom post type categories and sub categories, its build to show categories and the child if not present in the current custom post type as categories is used ...
1
vote
0
answers
19
views
Updating a remote media library plugin, wich breaks on php 8.1 update [closed]
We use the (now abandonware) plugin Remote media libary, with the Flickr add-on.
It allows the user to see the wordpress photos and albums in the media library.
https://wordpress.org/plugins/remote-...
0
votes
0
answers
41
views
how to assign javascript variable value to php variable in wordpress
I use following way to fetch the value of gtag if it already exists in the code:
<script>
const regex = /googletagmanager\.com\/gtag\/js\?id=([^\s'"]+)/gi;
const ...
0
votes
0
answers
18
views
WPCode - Modified date comparison with post date not working properly
I am working in WPCode to get the modified/updated timestamp of a post to show alongside the author of the article. So far the code will print "Last Updated On: <Month day, year> by X" ...
0
votes
0
answers
65
views
REST API Plugin Update call back not updating the plugin
I am working on a custom CRM which includes keeping an eye on my clients WordPress sites so I have created some custom REST API endpoints to collect different types of data like the installed plugins &...
0
votes
1
answer
44
views
adding firstname and lastname on registration
So i'm making a extension plugin FOR another plugin.
What i want to achieve is that i upon registration they are required to add their Firstname and Lastname, so i added the fields for it, i did the ...
0
votes
0
answers
269
views
Undefined constant ABSPATH
Only when I access the main url does this WordPress error appear and the content I edited does not appear
I looked in the error.log file and the following error appears
PHP Fatal error: Uncaught ...
0
votes
1
answer
27
views
How can I catch WordPress custom settings page slug has already changed?
I created a custom settings page like below.
add_menu_page(
__('Management', 'domain'),
__('Management', 'domain'),
'activate_plugins',
'management', // <---
...
0
votes
0
answers
34
views
Plugin question, How to insert a colon in a value box
I would like to be able to insert a colon into my number box. In this case, I would like to put a colon between 15 and 1 instead of the decimal, since it is describing a ratio, but when I do this it ...
1
vote
1
answer
66
views
Trying to find where %3$s is defined [closed]
I have this bit of code that creates the menu items:
$menu_classes = apply_filters( 'astra_' . $theme_location . '_menu_classes', array( 'main-header-menu', 'ast-menu-shadow', 'ast-nav-menu', 'ast-...
0
votes
0
answers
18
views
Editing stylehseet url in head section of WordPress
In our website, in the <head> section there is a call to a stylesheet and the URL is unsecured (HTTP). I would like to edit this to be https, but I'm not sure what file to edit to achieve this.
...
0
votes
0
answers
19
views
Help writing out comments and replies
I'm working on creating a comment system for an event plugin I am creating. I have the commenting and replies forms working correctly, I just need help with writing them out to the site. I am on MySql ...
1
vote
1
answer
47
views
External WP_Query call from PHP crashed after version update
I have an external script that does some DB maintenance through WP_Query and similar functions. It used to work great, but now after a PHP version update (from 7 to 8) it stopped working.
The ...
0
votes
0
answers
186
views
PHP Warning: Undefined array key “HTTP_REFERER”
I tried to read similar questions, but not easy for me to understand.
I have hundreds, maybe thousands, of those warnings my error_log, generated multiple times each day.
That’s the error.
[14-Jan-...
0
votes
0
answers
22
views
how switching from italian to german from internal to internal URL
Now when I’m on an internal page of the italian version if I select “deutsch” I land to the home page in german. Is it possible landing to the same internal page in german? my website:test.sacconicase....
0
votes
1
answer
109
views
Wordpress broken dashboard with ninja-shell text
I am facing some strange behavior on my bluehost hosted wordpress site. Here's what I am facing:
I see blank white page when I browse my website in a browser
I was unable to access to my site using ...
1
vote
0
answers
19
views
Modifying Slider Function for Decimal Precision
I'm working with the WordPress Traveler theme. In the Tour option, there is a slider used for Max People. Max People will be used for another purpose and should work with a precision of 0.1 instead of ...
0
votes
0
answers
43
views
How can I change text on my SearchWP search results page, as this is not an editable page in Wordpress?
I just want to change the text "Search results for:" to something else e.g. "All results for:"
The class is .page-title. I can't find this anywhere and I cant edit the page html as ...