Remove tags from wordpress head

I believe a filter on the_generator will do it. add_filter(  ‘the_generator’,  ‘__return_empty_string’, PHP_INT_MAX ); Reference: https://codex.wordpress.org/Function_Reference/_return_empty_string. https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/general-template.php#L2956

Adding code to head to all pages manually

You might use the wp_head action, That is triggered within the section of the user’s template by the wp_head() function. add_action(“wp_head”, “hook_js”); function hook_js() { if(is_home() || is_front_page(){ $output=”<script> alert(‘Page is loading…’); </script>”; echo $output; } } Note that is better to add style and script with the action wp_enqueue_scripts and then enqueue and register … Read more

Auto Generated HTML source code formatting

I know it’s really trivial Yes. Yes it is. …we are shooting to do the best job possible Spending any time whatsoever on fixing tab indentation in your output HTML as opposed to focusing on the quality of your source code is not doing “the best job possible”. You should be minifying your HTML on-the-fly … Read more

Removing auto versioning of JS and loading to header

If I’m reading correctly you just want to deregister a script but failed… I think that you tried to deregister it too early( before was added ). add_action( ‘wp_print_scripts’, ‘example’ ); function example() { wp_dequeue_script( ‘name_of_script’ ); } By calling the function in ‘wp_print_scripts’ should be fine, which is latter than ‘wp_enqueue_scripts’, where you usually … Read more

Can’t find where to modify attrbitutes

If you can’t edit your header.php, or would prefer not to, most decent WordPress themes should have (and certainly any that pass theme review to be in the official repository) <html <?php language_attributes();?> > in the opening html tag in the header.php template. There is a filter in the language_attributes() function that allows plugins/child themes … Read more

How to customize

If you want to add your own tags to WordPress pages use the wp_head action. To modify or remove <head> elements being added by Yoast you’ll need to use the filters they provide. As documented in that link you can modify the page title, author, keywords and more.

using wp_head in body tag for css style

It’s not working because you’re calling add_action after the actual action is fired. If you move the action declaration before wp_head() it will work: <html> <head> <?php add_action( ‘wp_head’, function () { echo ‘<style type=”text/css”>.sc_title {color:#fff; font-weight:600;}</style>’; }); ?> <?php wp_head(); ?> There’s no easy way to add some code to the head from the … Read more

Cannot retieve the_content() and the_author() – both returning empty strings

get_the_content and the_author have to be in a loop so you would need to use other functions to get the content you need global $wp_query; $post = $wp_query->post; $page_id = $post->ID; // page ID $page_object = get_page( $page_id ); // page stuff $author_id = $post->post_author; // author ID $page_content = $page_object->post_content; $author_name = get_the_author_meta( ‘display_name’, … Read more

Change default s.w.org dns-prefetch resource hint value

var_export( $hints ); gave me array ( 0 => ‘https://s.w.org/images/core/emoji/2.4/svg/’, ) so that means the array key is not s.w.org but https://s.w.org/images/core/emoji/2.4/svg/. Changing the function and using the key of the array with the full url did remove the s.w.org hint while still letting me use resource hints. function resource_hints( $hints, $relation_type ) { if … Read more

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