Can’t Update function.php after writing short code

The answer by @motivast is correct. However, to avoid using a billion echo and apostrophes, you can simply close the PHP tag and open it after your script: function wpse_287665_mobile_menu_script() { ?> <script> jQuery(document).ready(function($){ $(“button.menu-toggle”).click(function(){ if( $(“button.menu-toggle”).attr(“aria-expanded”) == “true” ) { $(“button.menu-toggle”).attr(“aria-expanded”, “false”); $(“ul#top-menu”).attr(“style”, “display:none;”); } else { $(“button.menu-toggle”).attr(“aria-expanded”, “true”); $(“ul#top-menu”).attr(“style”,”display:block;”); } }); }); </script><?php … Read more

Usage of do_action and add_adction

You need to echo your data. Try this instead – function add_link_to_aff() { $html_output = “<li><a href=”#”>” . __( ‘Test’, ‘yith-woocommerce-affiliates’ ) . “</a></li>”; echo $html_output; } add_action( ‘yith_wcaf_after_dashboard_links’, ‘add_link_to_aff’, 10 );

How to change the blog title with add_filter? details below

With the filter single_post_title, you can change the page/post title that is set in the <head><title>Page title</title></head>. If you want to change the title that you see in the page header. ( Which i think you want to do). Use this filter: add_filter(‘the_title’, ‘modify_all_titles’, 10, 2); function modify_all_titles($title, $id) { return ‘SOME TEXT BEFORE TITLE … Read more

Unable to show error message using wp_login action

Main problem with your code is that you use wp_login action. The wp_login action hook is triggered when a user logs in by the wp_signon() function. It is the very last action taken in the function, immediately following the wp_set_auth_cookie() call. So first of all – the user is already authenticated and his auth cookie … Read more

How can I add data to a custom column in the Users section of the wordpress backend?

manage_users_custom_column is a filter hook, so you should use add_filter() and not add_action(). Which also means you should return the output instead of echoing it. The column name is the second parameter and not the first one — which is the current value for the current column. So try with: function last_name_value($output, $column_name, $user_id) { … Read more