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.

0 votes
0 answers
23 views

Connection refused by Wordpress

I'm experiencing a complicated problem that I'm looking for help on. I have Wordpress served by Apache2 on a Raspberry Pi. I have a domain name with the DNS appropriately pointed to the server. I can ...
Justin's user avatar
  • 1
0 votes
0 answers
8 views

WordPress Customizer - How to save list of checkbox of pages?

I'm trying to create an option within the customizer that is basically a list of pages with checkboxes. I have that part working but I don't understand how to save it AND how to retrieve the saved ...
Jon's user avatar
  • 323
0 votes
1 answer
27 views

WordPress Customizer add_control Dropdown of Pages with Multi Select?

I have a customizer option that simply creates a dropdown populated with pages from the site. I need this dropdown to have the ability for multiple selections? Any ideas? $wp_customize->...
Jon's user avatar
  • 323
0 votes
0 answers
33 views

Registering a custom block style

I’m working on my first block theme and it’s giving me a lot of fun. I see there is a registered style in the block style tab to change the background image of the “row” block.. see the attached image ...
thara's user avatar
  • 1
0 votes
1 answer
77 views

Calling a function via a shortcode in javascript

I'm looking to dynamically change the page-comments option based on whether the user clicks a URL. I have two functions to do this: function psb_comment_listener_func(){ echo " <...
pbee's user avatar
  • 5
2 votes
1 answer
81 views

Programmatically convert single classic block to individual blocks via PHP

I am creating some posts via the wp_insert_post() function. When doing so the content gets saved in one big classic block. Is there anyway to force it to save as individual Paragraph blocks instead?
Tommizzy's user avatar
1 vote
0 answers
19 views

How to Dynamically Change the author_base URL Slug by Language in WordPress?

I am working on a multilingual WordPress site using WPML and I am trying to adjust the author_base URL slug based on the user's language. My goal is to have different slugs for each supported language ...
Robin Martijn's user avatar
0 votes
0 answers
59 views

Using WooCommerce Hooks to add product attribute descriptions to customer order email

My php days are long gone and I'm trying to achieve a "simple" customisation of the order email confirmation (processing and confirmed emails) sent to the customers of a Woocommerce webshop ...
Greg Vdo's user avatar
0 votes
0 answers
15 views

How do I make a shortcode to display Dokan seller badge list?

I am going to add the Dokan seller badge list to the single product page by creating a shortcode so that the tooltip is also displayed. Thank you for your guidance.
negar file's user avatar
0 votes
0 answers
34 views

Redirect to current URL and append specified URL parameter on unsuccessful login through Elementor login form widget

I have the following code running in the Code Snippets plugin, which works the way I need it to work for the most part. Basically I have the Elementor login form in a popup on my website, that way, a ...
David's user avatar
  • 1
0 votes
1 answer
42 views

Get generated block styles programmatically

If you use wp_head() in the header of your theme Wordpress generated a style tag for the Gutenberg block editor. Who knows how you can get the generated css style tag with the styles without using ...
Ruudje's user avatar
  • 21
1 vote
1 answer
71 views

Wordpress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted

I recently developed a custom Gutenberg block by utilizing the @wordpress/create-block package, which effectively generated a full plugin framework. I simply needed to tweak some existing files to get ...
Daniel V.'s user avatar
  • 131
1 vote
0 answers
41 views

Custom gutenberg block refuses to load viewScript and I don't know why

I've been struggling with this for hours. I used the @wordpress/create-block package to generate a template for me to create my first block. I've managed to create a hero block with an image uploader ...
Daniel van der Velden's user avatar
0 votes
1 answer
41 views

Adding a css class to the gallery

I'm using WordPress 6.5 with the old editor, I'm trying to add a CSS class on the div gallery when it specified in the shortcode, the code doesn't work, can you help me ? function custom_gallery_class(...
Barrista's user avatar
0 votes
1 answer
35 views

Send emails to individual subscribers when CPT post is deleted (trashed)

The context On my site I have a custom post type (project) where visitors can subscribe to a post and get various notifications via email. My site is hosted locally right now and I am using Mailhog ...
dekkyd's user avatar
  • 7
0 votes
1 answer
32 views

Run a WordPress blog (subdirectory) in a Laravel WebApp - SEO Concerns

I've developed a Laravel WebApplicaiton and now i'm in need of creating a WordPress Blog in a subdirectiory (domain.com/blog) I have concerns regarding SEO and if this new installation with canibalize ...
xake's user avatar
  • 3
1 vote
2 answers
118 views

Image alt tag is showing post title instead of Alt Text

The image alt tag shows the post title in the source instead of the Alt Text. function my_custom_image_sizes() { add_image_size('homepage-thumb', 329, 185, true); } add_action('after_setup_theme', ...
rudyards's user avatar
0 votes
1 answer
46 views

Uncaught Error: Undefined constant "WP_CONTENT_DIR"

When I reinstalled my Wordpress site on a new server, I was stuck with a HTTP ERROR 500 page, and this showed in the logs : [proxy_fcgi:error] [pid 87631:tid 140347891410624] [client xxxx:9316] ...
Orabîg's user avatar
  • 111
1 vote
2 answers
58 views

Custom Post Types in WordPress Dashboard List Rows But Data is Blank

I have a WordPress site that has several custom post types. Recently I moved it to Amazon Lightsail hosting which I've used for years. After the move, all my post types appear in the dashboard but ...
elke_wtf's user avatar
  • 383
0 votes
0 answers
15 views

Retrive the value of the Active variation of the product and then link it to the "read more" to dynamically change

Here is the code snippet where Only the tab-description is attached to the "Read-more". How to make it dynamically change based on the current active value of the Variation - material ...
Teresa's user avatar
  • 1
0 votes
1 answer
27 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
47 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
44 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
22 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
16 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
  • 449
0 votes
1 answer
60 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
12 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
97 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
47 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
33 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
18 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
22 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
31 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
1 vote
1 answer
34 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
  • 11
0 votes
0 answers
56 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
38 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
67 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
0 votes
2 answers
15 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
10 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
21 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
25 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
10 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
29 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
18 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
33 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

15 30 50 per page