Deactivating Specific Features in Squirrly SEO Plugin Using Hooks

Squirrly SEO has WordPress filters that turn a feature off, remove one group of tags from a page, or change the title and description it prints. You add them in PHP, in a must-use plugin or in your child theme, and the saved settings in Squirrly > All Features stay as they are.
Every filter name and argument below comes from the code of Squirrly SEO 14.2.8.
Where to add the code
- Create the folder
wp-content/mu-plugins/if your site doesn’t have it. - Add a file named
squirrly-custom.phpthat starts with<?php. - Paste the filters you need under that line and upload the file.
WordPress loads must-use plugins before Squirrly SEO, so every filter is in place in time. Squirrly checks the Sitemap XML, Robots.txt File and Llms.txt File switches while it loads, before the theme runs. A sq_option_ filter for those three works only from a must-use plugin. The other filters on this page also work from the functions.php file of a child theme.
Turn a feature off with sq_option_
Squirrly reads its settings with SQ_Classes_Helpers_Tools::getOption(), which passes the saved value through the filter sq_option_ followed by the option key. Return false and Squirrly acts as if the switch were off, in the admin and on the site.
// Turn off Open Graph, Twitter Card and JSON-LD
add_filter( 'sq_option_sq_auto_facebook', '__return_false' );
add_filter( 'sq_option_sq_auto_twitter', '__return_false' );
add_filter( 'sq_option_sq_auto_jsonld', '__return_false' );The filter changes the value Squirrly reads, not the one stored in the database. Remove the line and the saved setting is back. While the filter is active, the switch in the admin shows off, and screens that depend on it leave the menu. With sq_auto_facebook and sq_auto_twitter both off, Technical SEO > Social Media is hidden.

Option keys you can filter
| Switch in Squirrly | Option key | What off means |
|---|---|---|
| On-Page SEO METAs | sq_auto_metas | No title, description, keywords, canonical, robots or Dublin Core tags |
| Optimize the Titles | sq_auto_title | No title tag from Squirrly |
| Optimize Descriptions | sq_auto_description | No meta description |
| Optimize Keywords | sq_auto_keywords | No meta keywords |
| Add Canonical Meta Link | sq_auto_canonical | No canonical and no prev/next links |
| Add Robots Meta | sq_auto_noindex | No robots meta |
| Add Dublin Core Meta | sq_auto_dublincore | No Dublin Core tags |
| Open Graph Optimization | sq_auto_facebook | No Open Graph tags |
| Twitter Card Optimization | sq_auto_twitter | No Twitter Card tags |
| JSON-LD Structured Data | sq_auto_jsonld | No JSON-LD script |
| Sitemap XML | sq_auto_sitemap | No Squirrly sitemap (must-use plugin only) |
| Robots.txt File | sq_auto_robots | Squirrly stops serving robots.txt (must-use plugin only) |
| Llms.txt File | sq_auto_llms | Squirrly stops serving llms.txt (must-use plugin only) |
| Favicon Site Icon | sq_auto_favicon | No icon links from Squirrly |
| Webmaster Tools | sq_auto_webmasters | No verification codes |
| Google Analytics Tracking | sq_auto_tracking | No Google Analytics script |
| Facebook Pixel Tracking | sq_auto_pixels | No Facebook Pixel |
| Inner Links | sq_auto_innelinks | No inner links added to the content |
| SEO Links | sq_auto_links | No nofollow or new tab on external links |
| SEO Automation | sq_auto_pattern | Squirrly stops applying the Automation patterns |
| Auto-Indexing | sq_auto_indexnow | LLM Indexing stops and leaves the menu |
The same filter turns a feature on with '__return_true'. SEO Metas explains the meta switches one by one, and Advanced Settings covers the loading options.
Remove one group of tags from a page
Squirrly builds the head of each page from a list of filters. Each one starts as false, Squirrly fills it at priority 10, and it turns the result into HTML tags at priority 99. Return false from your own filter and that group is left out of the page.
| Filter | Removes |
|---|---|
sq_title | The title tag |
sq_description | The meta description |
sq_keywords | The meta keywords |
sq_canonical | The canonical link |
sq_noindex | The robots meta |
sq_dublin_core | The Dublin Core tags |
sq_open_graph | The Open Graph tags |
sq_twitter_card | The Twitter Card tags |
sq_json_ld | The JSON-LD script |
sq_google_analytics | The Google Analytics script |
sq_facebook_pixel | The Facebook Pixel |
sq_verify | The webmaster verification codes |
sq_favicon | The icon links |
This is the way to remove tags from some pages only, because the option filters above work for the whole site. The example takes Open Graph and Twitter Card off WooCommerce product pages and leaves them everywhere else:
add_filter( 'sq_open_graph', 'my_sq_no_social_on_products', 11 );
add_filter( 'sq_twitter_card', 'my_sq_no_social_on_products', 11 );
function my_sq_no_social_on_products( $tags ) {
if ( is_singular( 'product' ) ) {
return false;
}
return $tags;
}The old version of this tutorial wrapped the frontend filters in if ( ! is_admin() ). They run only on the site, so the condition isn’t needed.
Change the title and description with custom data
At priority 11, sq_title and sq_description get plain text: the value from the SEO Snippet or from the SEO Automation pattern. Squirrly then cleans the text at priority 98 and puts it in the tag at 99.
Title from a custom field
This example reads a custom field named my_seo_title. Change the name to the field your site uses.
add_filter( 'sq_title', 'my_sq_title_from_field', 11 );
function my_sq_title_from_field( $title ) {
if ( ! $title || ! is_singular() ) {
return $title;
}
$custom = get_post_meta( get_queried_object_id(), 'my_seo_title', true );
return $custom ? $custom : $title;
}Keep the first check. Squirrly passes false when the title is off for that page, and then it doesn’t wrap the value in a title tag. Text returned at that point would land in the head as plain text.
Description from a custom field
add_filter( 'sq_description', 'my_sq_description_from_field', 11 );
function my_sq_description_from_field( $description ) {
if ( ! $description || ! is_singular() ) {
return $description;
}
$custom = get_post_meta( get_queried_object_id(), 'my_seo_description', true );
return $custom ? $custom : $description;
}At priority 98 Squirrly removes scripts, styles and HTML tags from the description, so a field that holds HTML still prints plain text. Add Custom META Description covers the other two ways to set it.
Keywords
add_filter( 'sq_keywords', 'my_sq_keywords', 11 );
function my_sq_keywords( $keywords ) {
if ( is_singular( 'product' ) ) {
return 'wet cat food,cat food for kittens';
}
return $keywords;
}Return one string with commas between the keywords. At priority 20 Squirrly adds the post tags when Add the Post tags in Keyword META is on, and the tag is printed only while Optimize Keywords is on. Both options show in SEO Metas in SEO Expert mode.
Hide Squirrly tools in the admin
| Filter | Return false and |
|---|---|
sq_load_sla | The Live Assistant box leaves the editor and the Squirrly column leaves the posts list |
sq_load_snippet | The SEO Snippet is hidden, and AI Research, Optimize Posts and Bulk SEO show a permission message |
sq_load_css | Squirrly’s frontend CSS file isn’t loaded |
sq_load_buffer | Squirrly doesn’t read the page output, so it adds no tags to the head |
The first two take the user into account when you check the role inside the filter. Squirrly User Roles has an example for Authors. Remove the Squirrly fontend.css shows the CSS options.
Other filters for developers
| Filter | Arguments | What you can change |
|---|---|---|
sq_canonical_url | $url | The URL in the canonical link, og:url and twitter:url |
sq_og_article_author | $author, $post | The article:author value in Open Graph |
sq_post_images | $images | The images Squirrly picks for Open Graph and the Twitter Card |
sq_json_ld_data | $data | The JSON-LD data before it’s printed |
sq_structured_data_type_for_page | $types | The schema types of the page |
sq_custom_robots | $robots (text) | The full robots.txt text |
sq_custom_llms | $llms (text) | The full llms.txt text |
sq_buffer | $buffer | The whole HTML of the page (Squirrly adds its tags at priority 10) |
Add Custom JSON-LD Structured Data and How To Customize the Squirrly SEO Snippet Image have worked examples for two of them.
Troubleshooting
The filter has no effect
Clear the page cache first, then view the source again. If the filter is for the sitemap, robots.txt or llms.txt switch, move it from functions.php to a must-use plugin.
The tags are missing in the page builder preview
Squirrly doesn’t add its metas while Elementor, Divi, Bricks and the other builders show their preview. Check the live page instead.
My sq_title filter gets false
Squirrly has no title for that page. Automation shows “Squirrly SEO is not active on this post type.” for an excluded type, the page can have Activate Squirrly Snippet for this page off, or Optimize the Titles is off. Return the value unchanged in that case.
A setting shows off and I can’t turn it on
An sq_option_ filter on the site returns false for it. Search the theme and the must-use plugins for sq_option_.
Frequently asked questions
Does sq_option_ change my saved settings?
No, it only changes the value Squirrly reads while the code is active.
Which priority should I use?
Use 11 for sq_title, sq_description and sq_keywords, so your code gets the plain text before Squirrly wraps it.
Do these filters need the Advanced Pack?
No, they are all in the free Squirrly SEO plugin.
Can I turn off Squirrly on one page without code?
Yes, switch off Activate Squirrly Snippet for this page in the SEO Snippet of that page.
Related tutorials
- Add Custom META Title: the snippet, the pattern and the
sq_titlefilter. - Add Custom Open Graph MetaData: change the Open Graph tags of a page.
- Add Custom Canonical Link: set the canonical link from the snippet or from code.
- Squirrly User Roles: what each role can open, and the role filters.
- Check METAs with & without Squirrly SEO: see which tags Squirrly prints.



