Skip to main content

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

I have a php function with a shortcode to add share buttons, but I'm having an error!

I use a php function to create and add share buttons to specific places through a shortcode. It work's fine, but I'm getting this error: Warning: Array to string conversion in ...142-custom-shortcodes....
GKaplan's user avatar
1 vote
1 answer
58 views

Can't make an external api call in php side of wordpress child theme

Edited 07-14-24 to show permission callback in api Edit 2: showed my fatal error I'm new to making api calls in wordpress. I need to make an api call through the backend to a 3rd party api. I can't do ...
vroque2022's user avatar
0 votes
1 answer
48 views

Duplicated WP Multisite for testing environment is redirecting to production site

My goal is to have a test.example.de testing environment for my www.example.de WP Blog. Sadly, the site is still redirecting me to the production-site. My subdomain is registered as a CNAME with a TTL ...
Erick Holz's user avatar
0 votes
0 answers
33 views

Display posts based on the selected category when no subcategory is chosen

The following code displays posts based on subcategory. First dropdown is a custom taxonomy category, second dropdown narrows down the search to subcategories associated with selected category. My ...
Sebastian Szydlowski's user avatar
0 votes
0 answers
23 views

Problem with custom user fields default value and retrieval

I created 2 custom fields for users on my site, a Company name and a checkbox for whether a user has download access or not. Here is the snippet for the functionality: add_action( 'edit_user_profile', ...
Miroslav Kazimirovic's user avatar
0 votes
1 answer
16 views

WPML posts_joins on translated items

I found a way to filter the search query so it goes though the product_cat title and description to look for a term and then display all the connected product. I am now looking for a way to make it ...
allumette's user avatar
0 votes
1 answer
19 views

Show a text in menu

I am trying to show a custom text in menu. I am using below code on functions.php of current theme. add_filter( 'wp_nav_menu_items', 'add_search', 10, 2 ); function add_search( $items, $args ) { if ...
Foysal's user avatar
  • 445
0 votes
1 answer
78 views

Including product categories (product_cat taxonomy) title and description in search query

WHAT I'M TRYING TO DO I'm using woocommerce, but the question could work for WP categories also. When searching for a product, the search engine only looks for products info (title and description) ...
allumette's user avatar
0 votes
0 answers
13 views

Live Preview while customizing is not showing the updates while editing in WordPress

I'm working on a small website in WordPress, when clicking the "customize" button, it will open a page that shows a "Live Preview" of the website and allows you to add custom CSS ...
Zahraa's user avatar
  • 1
0 votes
0 answers
162 views

custom AJAX filtering logic and outputting results into an Elementor Loop Grid widget

basically as the title states, I am trying to output data into an Elementor Loop grid widget, using the infinite scroll pagination setting, however whenever I select an option that has only 1 post, ...
Bork's user avatar
  • 11
0 votes
1 answer
64 views

#038 & wordpress Help

Please help me edit the code so that wordpress does not change the & symbol to #038 when I publish links on my site function esc_url( $url, $protocols = null, $_context = 'display' ) { $...
James's user avatar
  • 1
0 votes
2 answers
37 views

Pre_get_comments and orderby comment_karma

I have ratings on a custom comment type that stores the ratings in the comment_karma meta of the comment. Now I want to pull up the comments for a specific user and sort them by rating. Here is what I ...
Aristocles's user avatar
0 votes
2 answers
23 views

translating a custom taxonomy term in a shortcode

I tryed this code but the german version is not working (italian is ok) $lang = substr( get_locale(), 0, 2 ); global $post; if ('it' != $lang ) { $term_name = get_the_terms(get_the_ID(), 'intro_'.$...
Andrea Sacconi's user avatar
0 votes
0 answers
24 views

Cannot Access ACF Field Values via my Plugin

Objective I am working on a WordPress site built using Timber/Twig. I have a plugin (built using standard PHP and saved in the standard plugins folder) that is supposed to grab ACF values from a ...
Isaac Hillaker's user avatar
0 votes
1 answer
35 views

Help with coding a link for a button in WordPress with The Events Calendar Plugin

This is my first time asking a question on Stack Exchange. Sorry if I don't do it right. I'm using WordPress on a client redesign. They sell courses on their site using the Events Calendar plugin. ...
Michelleee's user avatar
2 votes
1 answer
55 views

Calling a PHP function from a menu item

Please forgive this totally newb question. I'm not a dev, and I'm a little too far that I can deal with right now... I'd like to add a link to the WooCommerce cart page using the cart icon from my ...
Patrick's user avatar
  • 21
0 votes
0 answers
105 views

Remove datePublished and dateModified from Yoast Schema output on WordPress website

Google Search results are showing the date published or date modified of my website pages in the page meta description text. I have root caused it as coming from the Yoast SEO plugin: Schema is ...
Jon's user avatar
  • 1
1 vote
1 answer
59 views

Options of select field in a custom divi module ignore sorting

I made a little custom module for the Divi Builder which allows me to display a specific single post (from a custom post type). This works fine, but the options are not sorted correctly in the builder,...
Comaris's user avatar
  • 11
0 votes
1 answer
147 views

Remove slug and custom post type name from URL

I have a custom post type "treatment", under this CPT the taxonomy "treatment_category" which forntend slug is "category" right now the URL for category displaying as ...
user1419170's user avatar
1 vote
2 answers
17 views

how can I get the selected term of a custom taxonomy

Taxonomy name is "intro". I'm inside a shortcode so I dont need to echo.I need a variable for the selected taxonomy term to put in the return. What I do has no effect $terms2 = ...
Andrea Sacconi's user avatar
0 votes
0 answers
11 views

Getting checkboxes for some tags in a search box

I'd like to modify the following $array = array( 210 => array( 'id' => '210', 'name' => 'animali permessi su richiesta' ), 216 => array( 'id' => '216', 'name' => 'aria ...
Andrea Sacconi's user avatar
1 vote
0 answers
29 views

Wordpress Custom API GET request from External App with XML Parameter

I am new to WordPress API's and API's in general. I have an external app that is sending a GET request to my WordPress site with an XML string as the only parameter. I created a custom API that ...
Eugene's user avatar
  • 11
1 vote
0 answers
16 views

Custom filter not affecting gtag script position in WordPress footer

I am using a custom filter to place the gtag script in footer if it is applied in functions.php. The filter code is: if (apply_filters('myplugin_ga_script_position', $position = 'footer')) { ...
ahmedwp's user avatar
  • 21
1 vote
0 answers
32 views

Custom update for Woocommerce stock quantity [closed]

In my Wordpress store, products are set as simple, but I use WS Form to add attributes to the product/order. We sell travels packages. When a user purchase a product, the quantity decrease to 1. But ...
Paolo Montalto's user avatar
1 vote
0 answers
13 views

can not serialize and insert data from custom form

I have a custom form . My form have three input fields book_name, chapter_title and chapter_content. chapter_title and chapter_content are dynamic form fields. I want to insert book_name as post_title ...
Khalid Saiffullah's user avatar
0 votes
0 answers
11 views

How can i force replace a external js scripts language on the site itself?

Im using this https://www.gloriafood.com/ service and their translation is very poor. I would like to make adjustments myself. since it comes from an external source i cant really edit any spesific ...
Leo's user avatar
  • 1
1 vote
0 answers
34 views

Show Element at Certain Time in Wordpress

I'm trying to use the below code to show a button on Sunday mornings, but I dont want to use "date_default_timezone_set()" because it rewrites the Wordpress date and then the events show the ...
Kelsey Curran's user avatar
0 votes
0 answers
27 views

Translate string in another langage than Locale

I am developping a plugin for my company to register projects with some products. I am creating a purchase order for my supplier with this products. My local langage is french but my supplier is ...
mougeat's user avatar
0 votes
1 answer
19 views

Filtering according to the locale 'de_DE'

I already have a filter to show on archive pages the terms of the taxonomy "tipologia" according to the locale = 'de_DE'. I need a similar filter to show in german the same taxonomy terms ...
Andrea Sacconi's user avatar
1 vote
0 answers
41 views

Wordpress Plugin Update not working

I am facing an issue of update now button not showing up even if there is an update for a plugin. The following is the method that checks the updates for the plugin public function check_update( $...
ahmedwp's user avatar
  • 21
1 vote
0 answers
26 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 ...
semidivine's user avatar
0 votes
0 answers
20 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 ...
kunal saxena's user avatar
0 votes
0 answers
78 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 ...
ezequiel's user avatar
1 vote
0 answers
76 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 ...
Menelaos pc's user avatar
0 votes
1 answer
61 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> &...
Manikandan's user avatar
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) ...
Atiq Rev's user avatar
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 ...
Villas Villas's user avatar
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 ...
Marcel's user avatar
  • 1
1 vote
1 answer
12 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 ...
visyoual's user avatar
  • 111
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(); ...
user3418508's user avatar
0 votes
0 answers
44 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 ...
Nick's user avatar
  • 1
0 votes
0 answers
22 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 ...
Alexander's user avatar
2 votes
0 answers
56 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 ...
Miminou's user avatar
  • 21
0 votes
1 answer
108 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' ...
Overspeed's user avatar
0 votes
0 answers
57 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/...
Itse Sagay's user avatar
0 votes
2 answers
38 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 &...
Adam Larsson's user avatar
1 vote
0 answers
34 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','...
Adam Larsson's user avatar
0 votes
0 answers
12 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 ...
Sankar V's user avatar
  • 101
1 vote
0 answers
16 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. ...
Hendra's user avatar
  • 15
0 votes
0 answers
19 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, ...
ajs_app's user avatar
  • 15