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
0 answers
8 views

Disabling User Email Notifications for Erase Personal Data Utility

We need to make sure that whenever using the Erase Personal Data utility in WP for erasure requests, that it does not notify/email the user at any point. Really struggling to find a filter for ...
0 votes
0 answers
7 views

Saving meta box data from selected option's value in database is not working

I have added a organizer input filed using "select and option" tag, screenshot - https://prnt.sc/DtiJr5W178_g Here is my full code - // Callback function for Metabox <?php function ...
0 votes
0 answers
16 views

php 8 compability admin interface

so on php 8 on admin interface it not shows me the saved values of this code // F O N T S I Z E $val = $default['size']; if ( isset($typography_stored[...
0 votes
0 answers
16 views

an embeddable job widget showing job listings – discussion of an approach [closed]

I want to add some extra functionality to my WordPress site over and above: I want to add some specific features to my website that runs the wpjobmanager-plugin. that said: I want to create a ...
  • 1
0 votes
1 answer
33 views

PHP FATAL ERROR

My website has a PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/www/vhosts/katalytes.com/httpdocs/wp-includes/script-loader.php on line 706 ...
0 votes
0 answers
10 views

How can I make below code to show grouping by country ranks in same div, example if in second loop rank 2nd must be show in same 2nd class div

foreach ($get_data as $dataa) { $countries_0 = ''; $countries_1 = ''; $countries_2 = ''; $countries_3 = ''; $countries_4 = ''; $countries_5 = ''; if ($dataa->...
0 votes
0 answers
13 views

load-styles.php returning Error 503, and incidentally the WordPress dashboard is opening without any CSS [closed]

This is a problem I am having recently where the load-styles.php will not load on the dashboard/backend of my WordPress sites. This has happened across hosting providers, at least GoDaddy and ...
  • 101
0 votes
1 answer
8 views

Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only

I wrote below code but facing issue to run it only on archive, categories, author, date pages to improve page speed. add_action( 'wp_footer', function () { ?> <script> if( is_archive || ...
  • 3
0 votes
0 answers
50 views

why is this ajax callback to a REST endpoint still blocked by 'nosniff' due to MIME type ("application/json") mismatch?

i run WP on an nginx server i've setup a rest endpoint, targeted in an ajax callback if I enable a typical XCTO 'nosniff', more_set_headers "X-Content-Type-Options: nosniff"; in server ...
  • 1
0 votes
1 answer
26 views

Create a custom plugin with dynamic child pages listing database records

I am developing a simple lean and mean custom plugin which has the purpose to list records from some database tables. Goal is to list data via url /teams/{category}/{id}. I've created a basic plugin ...
0 votes
1 answer
13 views

add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico

Please Friend all, help me! How add_rewrite_rule in multisite subdomain from images via functions.php not .htaccess My Image Path https://cdn.domain.com/images/site2/favicon.ico But I want change url ...
0 votes
1 answer
47 views

functions.php doesn't load all custom theme assets

I'm writing a simple wordpress theme. I've added this function inside the functions.php file and I've noticed that only style.css is loaded. Is there something wrong that will cause that the other ...
  • 3
0 votes
0 answers
18 views

How to edit a widget code?

I use a Latest Portfolio widget, but it can show max 20, but I need 30. While using Inspector, I can see the counter from 1-20, but cannot figure out which file has it. I viewed almost all files but ...
0 votes
1 answer
25 views

WordPress Throwing Deprecated Errors on its own Files

My WordPress Website is throwing PHP Deprecated Errors on wp-include files. I am novice WordPress Developer working on my site. I am being flooded by these errors and extremely high CPU consumption on ...
0 votes
0 answers
13 views

Hide 'Downloadable' and 'Virtual' checkbox options from Woocommerce Variations?

I am trying hide / unset the 'Downloadable' and 'Virtual' checkbox options from Woocommerce entirely. I have managed to unset them everywhere EXCEPT in the Woocommerce Variations Panel here: Looking ...
  • 3
0 votes
0 answers
11 views

How Can Mark Product Featured WooCommerce using php code [closed]

I want mark product featured by id using code i tried this code but not working // Your Product ID $product_id = 43706; $ecd_product = new WC_Product( $product_id ); if( $ecd_product->exists() ){...
0 votes
1 answer
21 views

Adding Microsoft Teams Incoming Webhook to WordPress, Problem with Rest Route?

I am trying to implement an incoming webhook on my WordPress website to send a message to MS Teams when I receive a form submission. The message includes an ActionCard with a multiple choice input ...
0 votes
0 answers
11 views

Wordpress taxonomy and terms question

what i want to do is compare orcs from the game shadow of war. I have an idea of what I need to do, but I a not sure how to use wordpress taxonomies, categories and tags. I know enough php that could ...
0 votes
0 answers
9 views

generate excerpt from the part of big text dump that contains keyword

I'm working on an older site with a million plugins that just can't handle SearchWP and trying to mimic some of that plugins functionality. Things that ARE working: my search includes an ACF textarea ...
1 vote
1 answer
14 views

Include a static block inside of a dynamic block

we have a collection of static blocks and we want to insert one of our statick blocks inside the PHP code of a different dynamic block but so far we didnt manage to do it: Lets say the static block si ...
  • 13
0 votes
0 answers
15 views

wp_register_script - illegal string offset

I've noticed that in my plugin code there is something wrong. I'm getting an illegal string offset error in the dependency delcaration of the wp_register_script function ...
  • 3
0 votes
0 answers
24 views

Load style and script for custom post type metabox

I'm using this code to try loading some custom assets for a custom post type I have registered public function setup_theme_backend_assets($hook) { $screen = get_current_screen(); ...
  • 3
0 votes
0 answers
34 views

Word press - JSPDF - Sending PDF as attachment from wp_mail - Special characters

This is my very first post. Thanks to all your answers on other posts. Am using JSPDF to send an attachment through AJAX call to PHP server- A mail is sent from here with the generated PDF as ...
  • 1
0 votes
1 answer
42 views

public custom posts not showing in my wordpress plugin

I am building a WordPress plugin and I want to show all publicly registered custom post types (by theme or other plugins) in my plugin. But it only shows post and page custom post types not other ...
0 votes
0 answers
17 views

Permissions error when I use my plugin to delete comments in the front-end

I recently created a plugin for WordPress that allows you to delete comments from a front-end post, with an undo delete function and without having to reload the page each time (Ajax). However, when I ...
0 votes
0 answers
11 views

Custom CPT - Programmatically create categories to assign CPT when a new one is created

I'm creating a CPT using this code in my OOP plugin register_post_type( 'products', [ 'label' => __('Products', ''), 'description' =&...
  • 3
0 votes
0 answers
17 views

How to sort search result by post_title, then by post_content

How to sort search result by post_title, then by post_content For example - if i search for word "Ball" i want to get results where "ball" exists in title, then the results where &...
0 votes
0 answers
12 views

Custom Admin Menu Report for Specific User ID

I've been thinking for generating a custom revenue report for each user ID with an 'author' role monthly, which would be displayed on the backend. All my online users must be able to view their own ...
  • 1
0 votes
0 answers
20 views

Warning: Undefined property: wpdb::$question_overview in C:\Wamp.NET\sites\proxyvragenmodule\wordpress\wp-includes\class-wpdb.php

My question on stackoverflow was asked on the wrong part of my code I have an error that ive been dealing with since forever.. Im making a question viewer in wordpress and it shows this error Warning: ...
0 votes
0 answers
64 views

Fatal Error: Uncaught ArgumentCountError: Too few arguments to function - on logout of wordpress dashboard

I am getting a fatal error when trying to login to the WP dashboard - and on logout after logging in via the host: Fatal error: Uncaught ArgumentCountError: Too few arguments to function Wpsec\captcha\...
0 votes
0 answers
8 views

I can't log into my website , it says "Error: Cookies are blocked due to unexpected output"

I have seen others with this same problem but when I google it it resolves it in a lingo I don't understand. I need a simple answer.
0 votes
2 answers
42 views

Font Awesome Icons as squares [closed]

I have been trying to migrate my html css and javascript static website to a wordpress dynamic theme. Everything worked fine and looks perfect but for some reason my font awesome icons appear as ...
0 votes
1 answer
7 views

How can I remove paginated SEO titles from my WordPress site?

Does anyone know how to change the text of the SEO title on a paginated page on WordPress? Or remove it entirely? Right now, it's like "Blog | Page 2" I want to translate it to my own ...
  • 25
0 votes
0 answers
18 views

Styling best practices for single pages/templates

What's the best practice for CSS that is specific to one PHP file? For example, let's say I make a page page-456.php that is styled differently from the rest of the site, what's the best practice to ...
  • 101
0 votes
1 answer
25 views

Wordpress Query - Blog Cards Duplicate issue

My Blog Cards are duplicating every three cards. How can I solve this? <div class="blog-container-ehukuk"> ...
  • 25
0 votes
1 answer
23 views

Link on post title only if post have content

Hello i create an archive.php custom for category-id (category-id.php) and use this code <?php /** * A Simple Category Template */ get_header(); ?> <section id="primary" ...
0 votes
0 answers
5 views

How to limit number of posts in the certain category and exclude the oldest post automatically

I would like to have a php code which will exclude the oldest post from the certain category of certain taxonomy if total number of posts in this category (in the time of adding a new post) greater ...
0 votes
0 answers
21 views

What is wrong with my sorting logic?

Trying to sort a custom query. I need the values to be sorted based on the menu order. The following code prints out all the values as expected, but not in any sorted order. I'm trying to get the ...
1 vote
2 answers
35 views

How to use a conditional statement in a post loop but not count towards the "posts_per_page" if false

I have a WP_Query which has the "posts_per_page" parameter set to 12. I am then using a while loop to iterate over all of the posts and an IF statement to check whether a condition is true ...
  • 11
0 votes
1 answer
31 views

Count the number of matching post names in foreach loop

I have a simple foreach loop that outputs an ordered list from a CPT 'post_subscribers' and an associated meta key called 'project'. $theposts = get_posts( array( 'post_type' => '...
  • 3
0 votes
0 answers
41 views

footer doesn't display

I'm trying to code in the file index.php, but the footer and the slider that is in the content.php file don't display. index.php code: <?php get_header(); if (have_posts()) : while (...
  • 1
0 votes
0 answers
9 views

hiddenQuestions.find is not a function

I have a code like this: var hiddenQuestions = listQuestions.hidden_questions; var find = hiddenQuestions.find(function (questionId) { return parseInt(question.id) === parseInt(...
  • 31
0 votes
0 answers
14 views

how can i link threejs in my functions.php file in understrap theme

i'm trying to create a portfolio website with wordpress understrap and i want to integrate threejs in the website, only it's not showing on the page and i dont know how to link the threejs code in ...
0 votes
0 answers
32 views

WordPress / PHP: Check if column has value and then check if value in array

I have a table called wp_invites which contains a list of names (and other data) for those invited to an event. Below are 4 rows from the table: id handler lead_name party reference ...
  • 145
0 votes
0 answers
8 views

what to do after instlling cyberpanel on VPS

I am upgrading from shared hosting to VPS hosting, so I went with digitalocean and used marketplace to create a droplet with cyberpanel, linked my domain to the droplet, moved data, and almost done. ...
0 votes
1 answer
83 views

WordPress PHP8 Critical Error in class-wp-widget.php

Recently updated to PHP8 and I'm getting a critical error related to the theme. The critical error is: Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Widget::__construct(), ...
  • 1
0 votes
0 answers
17 views

How can I improve and optimise my wordpress web server for better performance in 2023

How can I better optimise my Ubuntu 22.04.2 LTS wordpress website web server for better performance Well what I want to know is any good wordpress tricks that actually work well specially when it ...
0 votes
1 answer
18 views

Why is my custom email notification after purchase not sending?

I'm trying to send an email to a specific address (the admin) but online if a customer purchases one of four specific products. I'm using this code in my functions.php in my plugin for the page. But ...
  • 3
0 votes
0 answers
23 views

Nav menù doesn't display selected pages

I've included Elementor inside my custom plugin and now I'm creating my wp site layout. I've noticed that my nav menu will show all the pages I have created for my website, but from the settings I've ...
  • 3
0 votes
1 answer
24 views

AJAX WP_Query's order and orderby parameters not working

TL;DR SUMMARY OF PROBLEM AJAX will not use the proper order and orderby parameters given, and instead sorts post by menu_order (posts section doesn't even have post attributes set as true). PROBLEM ...

1
2 3 4 5
207