Allow the access over wp-login.php

Use the hook template_redirect instead – this will ensure it only runs on the front-end of your site, and not for the admin, login, registration or signup pages. function wpse_159552_maintenance() { if ( ! is_front_page() ) { wp_redirect( home_url() ); exit; } include ‘maintenance/index.html’; exit; } add_action( ‘template_redirect’, ‘wpse_159552_maintenance’ );

Force changing the Site Title and add link

add_filter(‘option_blogname’, ‘filter_name’); function filter_name($string) { return str_replace(‘original’, ‘replacement’, $string); } This code should work, as well as yours. But there’s one catch, you have to use get_bloginfo like this: echo get_bloginfo(‘name’, ‘raw’); If not, bloginfo sanitizes the output, and it eliminates the <a></a>. At the same time is someting good, because if not you would … Read more

Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?

Figured it out for anyone who wants to know: function update_school( $post_id ) { $post_author_id = get_post_field( ‘post_author’, $post_id ); // get the post author ID $school_name = get_the_author_meta( ‘school2’, $post_author_id ); // from the post author ID, get the author meta $term = term_exists( $school_name, ‘school’); wp_set_post_terms( $post_id, $term, ‘school’ ); } // run … Read more

Blank child theme – functions.php problem

I’ve created a child theme, and moved all the modifications I had in the parent theme functions.php into the child theme’s functions.php Don’t move all the functions from the parent theme into the child theme, just add the modifications to the child theme and leave the parent functions.php as it came with the theme. You … Read more

Register a widget area when a theme option has been saved?

In functions.php write this code function my_optionally_widgets() { $option = get_options(‘wantwidget’); if($option == ‘yes’) { register_widget(‘mywidget’); /* add other widgets for registration here */ } } add_action(‘widgets_init’, ‘my_optionally_widgets’); function my_optionally_sidebars() { $option = get_options(‘wantsidebar’); if($option == ‘yes’) { register_sidebar($args); /* add other sidebars for registration here */ } } add_action(‘init’, ‘my_optionally_sidebars’); Remember that Widget Areas … Read more

Add Function For Instances of Custom Text in Multiple Category IDs to display in post content

This doesn’t actually look like a WordPress problem, but rather a lack of PHP skills unfortunately. Your problem lies in this piece of code $custom_category_text=”<p> ” . $office[$office_random[0]] . ‘ ‘ . $office1[$office1_random[0]] . ‘</p>’; // Category ID = 1 if (in_category(‘1’)) { $content = $content . $custom_category_text; } return $content; $custom_category_text=”<p> ” . $home[$home_random[0]] … Read more