Purpose
This filter allows you to customize or remove the prefix used in the anchor IDs and links generated by the Table of Contents (TOC) feature in All in One SEO.
By default, All in One SEO adds a prefix of “aioseo-” to the anchors in our Table of Contents Block.
NOTE:
This filter only works on new posts and headings where an ID is not already present.
Version Added
This filter is available in All in One SEO 4.7.1 and above.
Arguments
1. $prefix (string): New prefix. By default, this is set to “aioseo-“. You can modify it to another value or an empty string.
Example Code Snippet
The code snippet below is just an example of how this filter can be used. In the example below, a different prefix “mysite-” is used in the IDs instead of the default “aioseo-“.
In the code snippet below, the prefix is completely removed by passing an empty string.
Implementation
Need help using our code snippets? Checkout our documentation on “How do I use your API code examples?“.
We recommend using the WPCode plugin for safe and secure implementation. WPCode performs multiple sanitization tests before activating the snippets, ensuring the safety of your website.