Category Archives: wordpress

Debugging duplicate query exec in WordPress

During debugging a plugin malfunction I had duplicate option update SQL queries and after som thinking I came up with the following debug line to catch the trace of duplicate function call: error_log(var_export(debug_backtrace(), true)); I placed it above the return … Continue reading

Posted in Uncategorized, wordpress | Tagged | Leave a comment

Mail sending via SMTP for WordPress

I was looking for some really simple SMTP solution for WordPress, only some code to send emails via SMTP. Without a plugin for localhost usage. Came up with the following script in wp-content/mu-plugins/smtp.php <?php add_action(‘phpmailer_init’, ‘custom_phpmailer_init’); function custom_phpmailer_init($phpmailer) { $phpmailer->IsSMTP(); … Continue reading

Posted in Uncategorized, wordpress | Tagged , | Leave a comment

WordPress custom search for custom post type

After creating a custom post type for an Inventory plugin the client needed also customized search for the columns. First the pre_get_posts looked as a good candidate for hooking, but ended up with filtering via posts_clauses_request add_filter(‘posts_clauses_request’, ‘customSearchClause’); function customSearchClause($query) { global … Continue reading

Posted in Uncategorized, wordpress | Tagged , , | Leave a comment

Use WordPress core as PHP framework

For a task I required using headless WordPress, just the core without a template. Using as a PHP framework. More info about integration is available at http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website Power tip: To avoid plugins redirecting after requiring wp-blog-header.php define DOING_CRON const or might … Continue reading

Posted in php, wordpress | Tagged , , | 2 Comments

WordPress backend works fine but frontend is white screen

Had the white screen (blank page) issue without PHP or other error in logs or on screen. wp-admin worked. After some hours I decided to switch theme and it fixed the problem. I removed the default twentyfifteen and imported an … Continue reading

Posted in wordpress | Tagged | Leave a comment

Fix language of WooCommerce ‘Thank You’ redirect URL for qTranslate

I struggled a bit with wrong translation of the thank you page. For translation I used qTranslate and IM8 qTranslate WooCommerce Looking at the Network tab in Chrome I saw the 301 redirect, but it took a while to figure out … Continue reading

Posted in woocommerce, wordpress | Tagged , , | Leave a comment

Redirect images (other media) content to live production site

During some redesign projects it’s handy to have the images (other media) rendered, but sometimes it could be a struggle to download from specific paths. For WordPress sites I use the following htaccess rule: RedirectMatch 301 /wp-content/uploads/(.*)$ http://www.example.com/wp-content/uploads/$1 Than for … Continue reading

Posted in wordpress | Tagged , | Leave a comment