Use admin-post to submit form data to external database

I’m answering this question to help future WordPress developers on their quest for knowledge. The answer is YES, you can connect to an external database when using the admin_post action. Below is the corrected source… <?php class x94 { private $externalDB01; public function __construct(){ add_action( ‘admin_post_submitForm9’, array( $this, ‘formHandling’ ), 11, 1 ); add_action( ‘plugins_loaded’, … Read more

TinyMCE 4.7.11 – Enable hidden WordPress core plugins? (referencing a wp-includes from plugin.php)

Am I right to think colorpicker is still supported and just disabled? Yes, it is still supported; however, it’s not disabled, and it’s actually loaded by default by WordPress, because the textcolor plugin (which is also loaded by default by WordPress) depends on the colorpicker plugin. I was hoping just adding the button would work. … Read more

Override theme’s WooCommerce file

You can use the wc_get_template filter, which allows you to override the absolute filepath to a template just before it’s included. For example, this overrides checkout/payment.php: add_filter( ‘wc_get_template’, function ( $file, $name ) { if ( $name === ‘checkout/payment.php’ ) { // $file must be an absolute filepath // e.g. path relative to current file … Read more

Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?

Okay, I’ve had two big projects where I’ve been in control of the server enough to namespace and rely on autoloading. First up. Autoloading is awesome. Not worrying about requires is a relatively good thing. Here’s a loader I’ve been using on a few projects. Checks to make sure the class is in the current … Read more

Replace “content-area” of themes 404 page with plugin?

According to the Template Page hierarchy, https://developer.wordpress.org/files/2014/10/wp-hierarchy.png the only template page WP will load is 404.php But, you might try this in your mu-plugins: //Some function to check database to see if this URL should exist if ( ! checkIfPageExists( $_SERVER[‘REQUEST_URI’] ) ) { //Set 404 Status status_header( “404” ); get_header(); //do your custom 404 … Read more