Why is there a bunch of WordPress HTML code in my browser CSV download?

This code cannot run in a shortcode: if ( $_SERVER[‘REQUEST_METHOD’] == ‘GET’ && isset($_GET[‘CSV’]) ) { require_once __DIR__ . ‘/../assets/helpers.php’; // contains csv_download() function csv_download(); } The problem is that by the time a shortcode executes it’s too late to send HTTP headers, and WordPress has already sent the theme header and HTML body tags. … Read more

How to make WordPress Plugin run on single specific Admin Page

You should use the load-edit.php action hook, and check for your post type (untested): add_action( ‘load-edit.php’, static function () { $screen = get_current_screen(); if ( empty( $screen->post_type ) || ‘myposttype’ !== $screen->post_type ) { return; } new the_function(); } ); You could also use the current_screen hook, but load-edit.php seems more correct.

Custom fields in the billing address section woocommerce

I have run into these issues before myself. I am not entirely sure it’s possible to get adjust the billing address box directly unless you adjust the actual email template for the emails. Specifically, if you have access to the file structure, look in the “/wp-content/plugins/woocommerce/templates/emails” folder of the WooCommerce Plugin. They are made to … Read more

REST API – filters not working inside plugin class

This is a problem: public function __contruct() it should be __construct, the S is missing, meaning there is no constructor and the add_filter calls never happen The function that registers the routes also never runs because the add_action call is commented out: //add_action( ‘rest_api_init’, array( $this, ‘extend_default_routes’ ) ); This means the constructor never runs, … Read more

WordPress hack code issue, help required

This will try to load PHP code from one of three servers, the three base64-encoded strings, and execute the first one it successfully fetches on your server. Those domains do still exist, so this is potentially an active hack. They don’t return any data to me when tested but I hadn’t set a domain in … Read more

Too few arguments – wp_login action

The custom role needs the read capability to view the backend. Example: $your_role = get_role(‘your_custom_role’); $your_role->add_cap( ‘read’ ); See: https://wordpress.org/documentation/article/roles-and-capabilities/#read Ideally, this should only be done once, e.g. when activating your plugin or theme.