it-source

헤더에서 워드프레스 피드 URL을 삭제/제거하는 방법

criticalcode 2023. 2. 22. 22:15
반응형

헤더에서 워드프레스 피드 URL을 삭제/제거하는 방법

삭제/삭제 방법wordpress feed의 URLhead을 추가하다header.php?

다음의 URL 의 예를 나타냅니다.

<link rel="alternate" type="application/rss+xml" title="Example Business &raquo; Feed" href="http://example.com/feed/"/>
<link rel="alternate" type="application/rss+xml" title="Example Business &raquo; Comments Feed" href="http://example.com/comments/feed/"/>
<link rel="alternate" type="application/rss+xml" title="Example Business &raquo; Home Page Live Comments Feed" href="http://example.com/home/feed/"/>

같은 플러그 인을 사용하고 싶지 않습니다.

최근 피드 URL 링크 요소를 제거해야 하는 경우가 있어 WordPress의 핵심 기능을 커스터마이즈하지 않도록 하기 위해 다음과 같은 솔루션이 작동합니다.

를 가지고 있는지 확인합니다.functions.php사용 중인 테마 디렉토리에 파일을 저장합니다.그렇지 않으면 파일을 만들고 편집합니다.다음 행은 선택한 행을 에서 삭제하는 데 도움이 됩니다.wp_head()기능:

<?php
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post.
remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version
?>

WordPress 테마/플러그인에 이 코드를 추가할 수 있습니다.WordPress 피드 태그를 포함하여 모든 불필요한 태그를 헤드로부터 제거합니다.

Github Gist URL : https://gist.github.com/coder618/29782921f79235f26285847916c2a122

add_action( 'after_setup_theme', 'prefix_remove_unnecessary_tags' );

function prefix_remove_unnecessary_tags(){

    // REMOVE WP EMOJI
    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('wp_print_styles', 'print_emoji_styles');

    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );


    // remove all tags from header
    remove_action( 'wp_head', 'rsd_link' );
    remove_action( 'wp_head', 'wp_generator' );
    remove_action( 'wp_head', 'feed_links', 2 );
    remove_action( 'wp_head', 'index_rel_link' );
    remove_action( 'wp_head', 'wlwmanifest_link' );
    remove_action( 'wp_head', 'feed_links_extra', 3 );
    remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
    remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
    remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
    remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
    remove_action( 'wp_head',      'rest_output_link_wp_head'              );
    remove_action( 'wp_head',      'wp_oembed_add_discovery_links'         );
    remove_action( 'template_redirect', 'rest_output_link_header', 11 );

    // language
    add_filter('multilingualpress.hreflang_type', '__return_false');
}

RSS FEED 버튼을 삭제하는 가장 간단한 방법은 [Affectance] / [Editor] / [REMOVE]으로 이동합니다.

 <div id="profiles" class="clearfix gutter-left">
                 <?php do_action( 'graphene_social_profiles' ); ?>
           </div>

테마 헤더(header.php)에서 그래핀을 찾을 수 있습니다.다른 방법은 안 되는데, 이 방법은 아주 간단해!!!테스트 완료!!!PS: 그래핀을 변경하는 동일한 유형의 스크립트를 찾습니다.테마의 이름이 붙은 단어입니다.

언급URL : https://stackoverflow.com/questions/34750148/how-to-delete-remove-wordpress-feed-urls-in-header

반응형