WordPress Child Themes

It is somewhat counter-intuitive but WordPress loads child’s theme code before parent’s theme. So wrapping anything in function_exists() in child theme does nothing, it’s parent theme that needs to have that. Better option is to unhook parent’s theme function (unless it’s run right at load, which it should not do) and hook your own.

Calling an API to do authentication / user login

It’s better not to do so. And I’m completely against overriding the default authentication mechanism simply because of WordPress and it’s plugins usually are depended on the website’s database. But if you’re really into this situation WordPress provides a filter called authenticate: add_filter( ‘authenticate’, ‘wpse75679_auth’, 30, 3 ); function wpse75679_auth( $user, $username, $password ) { … Read more

Overriding functions in wordpress plugins

If the plugin displays content via any function, the code: if(!function_exists(‘function_name’)) function_name(); … is used for safety. If your plugin is disabled, and the if (!function_exists(‘function_name’)) is missing, your theme will throw a fatal error.

WordPress Registration Email by Role

Scroll down a little bit, most of it is WordPress default code but you must add everything to your plugin or you might break it! I’ve also added few useful snippets below. Copy-paste them to same plugin. <?php /* * Plugin Name: Emails * Plugin URI: http://www.your-site.com * Description: Different registration email for different roles … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)