Linux 软件免费装
Banner图

Disable Random Content

开发者 kaggdesign
ernest35
更新时间 2026年12月4日 02:04
PHP版本: 7.4 及以上
WordPress版本: 7.2
版权: GPLv2 or later
版权网址: 版权信息

标签

redirects multisite random posts random content random url

下载

1.3.4 1.3.0 1.3.1 1.0.0 1.2.0 1.3.2 1.3.3 1.1.0 1.3.5

详情介绍:

Disable Random Content turns off WordPress 7.2's built-in random redirects as soon as you activate it. You can keep random links for selected categories, tags, and other archives, including on sites that use WPML or Polylang. For example, on a WPML site you can allow a random link for your English Blog category while keeping random redirects disabled on its translated archives and at the site-wide /random/ URL. WooCommerce and Multisite. Keep a random link for a selected WooCommerce product category. On Multisite, each site has its own archive selection. Choose the archives you want to allow under Settings > Disable Random Content. For example, selecting Blog enables its random URL, such as /random/category/blog/. You can activate the plugin on WordPress 7.1 ahead of the upgrade, either for one site or across a Multisite network. It starts controlling random redirects when the site runs WordPress 7.2 or later. Start the Live Preview and click Open demo homepage to try both links. The setup guide covers installation and Multisite. If the demo opens on an earlier WordPress version, open Site Settings in the Playground toolbar, select WordPress 7.2 or later, and click Apply to this Playground.

安装:

  1. On a self-hosted WordPress site, go to Plugins > Add New Plugin and enter slug:disable-random-content in the keyword search field.
  2. Install and activate the plugin. On Multisite, activate it for one site or across the network.
On WordPress.com, search for Disable Random Content by its full name in Plugins. Plugin installation is available on WordPress.com paid plans. No settings or manual permalink changes are required. With WP-CLI, run wp plugin install disable-random-content --activate for a single site or wp plugin install disable-random-content --activate-network for a Multisite network.

屏幕截图:

  • The demo homepage shows the three test links and how to switch the allowed category.
  • The site-wide /random/ URL returns a 404 on the demo site while the plugin is active.
  • The allowed Blog category's random link opens one of its published posts.

常见问题:

How do I disable random redirects in WordPress 7.2?

Activate Disable Random Content. It turns off the default /random/ URL, random redirects on archive URLs, and redirects triggered by the random query parameter. It uses the wp_enable_random_content_redirect filter and supports a custom Random base set in Settings > Permalinks, such as /shuffle/.

Does it disable random ordering in themes or other plugins?

No. Unrelated queries that explicitly request random ordering are unaffected.

What happens to /random/ after activation?

WordPress serves a published page or post that has /random/ as its permalink. If no other route handles the address, WordPress usually returns a 404.

Does it change my posts, pages, or menus?

No. It does not edit content or menus. Published content remains available at its usual URLs.

Do I need to resave my permalinks?

No. The plugin refreshes permalink rules when activated or deactivated on an individual site. Changing the allowed archives or the plugin's network activation clears the affected sites' saved rules, and WordPress rebuilds them on the next request. If a page cache or CDN keeps serving an earlier response after a change, clear the cached response for the affected URL and test again.

Can I disable random redirects across a WordPress Multisite network?

Yes. Activate the plugin across the network to disable the built-in random redirects on all sites. For a rollout to selected sites, activate it individually on each site. Each site can allow random links for its own archives.

Can I keep a random link for just one category?

Yes. In Settings > Disable Random Content, select just the category you want to allow. For example, selecting Blog enables /random/category/blog/ and /category/blog/?random. The site-wide /random/ stays disabled. WordPress can pick posts from subcategories when choosing from a parent category. To enable a subcategory's own random link, select that subcategory separately. You can also allow links for specific tags and other eligible archives. On a WooCommerce site, select only the Blog category to keep its random link and stop /random/shop/ from choosing a product. Visitors can browse the store at its usual shop and product URLs. To keep a random link for one product category, select it under Product categories and leave the Products post type archive unselected. The selected category can open a random product while the shop and other categories continue to open as usual. For a custom post type, select its archive under Post type archives. For example, with the default random base, allowing an eligible Projects archive with the slug projects enables /random/projects/ and /projects/?random=1. A post type appears in the list when it is publicly queryable, has an archive, and supports random selection in WordPress.

Why isn't a selected archive redirecting?

If a code snippet or another plugin disables random redirects across the site, turn off that snippet or setting. In Admin Optimizer, turn off Disable Random Content Redirect under Content Controls. In Admin and Site Enhancements (ASE), clear the random content redirect checkbox under Disable Components > Disable Smaller Components. Try the selected archive's random URL again. If the redirect is still missing, go to Settings > Permalinks and click Save Changes to rebuild the rewrite rules.

Why does /?random=1 still redirect with Jetpack or on WordPress.com?

Jetpack 16.4 and the legacy WordPress.com handler can redirect /?random=1 separately from WordPress core. Test both /random/ and /?random=1 on your site after activating Disable Random Content. Jetpack's update to use the WordPress core handler also applies the jetpack_random_redirect_enabled filter to core redirects. If a custom snippet returns false for that filter, review it when upgrading Jetpack. It can switch off random links for your selected archives too.

Can I restore all of WordPress's built-in random redirects?

Deactivate the plugin to restore the core behavior. Other code on your site may still disable the feature.

Does the plugin contact external services or store data?

The plugin makes no external requests and adds no tracking. Archive selections are stored in a WordPress option for the current site. WordPress rebuilds the site's permalink rules after changes to the selections.

更新日志:

1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.0 1.1.0 1.0.0