Skip to content

Commit f692379

Browse files
authored
Add disable author archives
1 parent 0a1d4c7 commit f692379

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- This is a code snippets export file generated by the Code Snippets WordPress plugin. -->
3+
<!-- https://wordpress.org/plugins/code-snippets -->
4+
<!-- To import these snippets a WordPress site follow these steps: -->
5+
<!-- 1. Log in to that site as an administrator. -->
6+
<!-- 2. Install the Code Snippets plugin using the directions provided at the above link. -->
7+
<!-- 3. Go to 'Tools: Import' in the WordPress admin panel. -->
8+
<!-- 4. Click on the "Code Snippets" importer in the list -->
9+
<!-- 5. Upload this file using the form provided on that page. -->
10+
<!-- 6. Code Snippets will then import all of the snippets and associated information contained in this file into your site. -->
11+
<!-- 7. You will then have to visit the 'Snippets: All Snippets' admin menu and activate desired snippets. -->
12+
<!-- generator="Code Snippets/2.8.6" created="2017-08-13 03:17" -->
13+
<snippets>
14+
<snippet scope="2">
15+
<name>Disable author archives</name>
16+
<desc></desc>
17+
<tags>author, archives, wordpress, disable</tags>
18+
<code>function disable_author_archives() {&#13;
19+
&#13;
20+
if (is_author()) {&#13;
21+
&#13;
22+
global $wp_query;&#13;
23+
$wp_query-&gt;set_404();&#13;
24+
status_header(404);&#13;
25+
&#13;
26+
} else {&#13;
27+
&#13;
28+
redirect_canonical();&#13;
29+
&#13;
30+
}&#13;
31+
&#13;
32+
}&#13;
33+
remove_filter('template_redirect', 'redirect_canonical');&#13;
34+
add_action('template_redirect', 'disable_author_archives');</code>
35+
</snippet>
36+
</snippets>

0 commit comments

Comments
 (0)