How to apply a function to the value $email of get_user_by to override email_exists?

Based on your code, I think the problem may have been that you were checking a variable that was undefined. You were checking $db_email, which in your function was an undefined value, so you’d be looking for an empty result. You need to check the value passed to email_exists() (which would be the email being … Read more

If post exists, make it a comment in existing post with same name?

You can use get_page_by_title http://codex.wordpress.org/Function_Reference/get_page_by_title to check if another page/post is using the same title. If so, get the content of that post and insert it using wp_insert_comment, and delete the original post with wp_delete_post. Finally, glue all these together inside the save_posts action hook.

Check from functions.php if function exists in footer.php

You should not declare functions in your templates. The templates are for outputting content. The function_exists() will check if the function is declared before the function_exists() call, not after it, and templates are loaded after functions.php file, since you can control them by using the template_redirect filter. Declare your function in your theme’s functions.php file, … Read more

Why would someone use function_exists(‘add_action’) in a plugin?

As you understand correctly, this is a way to ensure the file is included from wordpress core and it is not accessed directly. Most wordpress installations do not prevent a direct access to any file, therefor his check is needed to prevent bad actors from exploiting know weakness in a specific file’s code. Yes we … Read more

wp_star_rating() – Adding a 5 star rating system to theme

Instead of redefining wp_star_rating() for the front end, you should be able to just use the built-in function. From the Codex page for wp_star_rating(): In order to use this function on the front end, your template must include the wp-admin/includes/template.php file and enqueue the appropriate dashicons CSS font information. (emphasis mine) A code sample is … Read more

How can I modify footer when footer.php calls to another file?

You can remove_action and add_action with your own action. (https://codex.wordpress.org/Function_Reference/remove_action) In your child theme functions.php you can add this code for example : add_action(‘init’, ‘remove_talon_footer’); // Remove your parent theme actions function remove_talon_footer() { remove_action(‘talon_footer’, ‘talon_footer_sidebar’, 7); // Use same priority remove_action(‘talon_footer’, ‘talon_footer_credits’, 8); remove_action(‘talon_footer’, ‘talon_footer_menu’, 9); } /** * Footer sidebar */ function my_talon_footer_menu() … Read more