DUPLICATE/NO BUG: Can't change link css selectors a second time

Browser: Any
OS: Any

I changed Theme > Links > css selectors by adding a filter in functions.php to completely override the default selectors. This worked and I could see the selectors in the theme links field and when inspecting the page.

However, I noticed that I had an error and so changed the filter but the change was not applied. I tried clearing the litespeed cache and my browser cache but the original selectors still showed. I tried making another change to the theme styling and saving to make sure the entire theme was rebuilt but this made no difference. I also tried removing the filter, saving and clearing caches but this made no difference.

So basically once you have changed the css selectors with a filter in functions.php, you can’t change them again. So I’m now stuck unable to resolve the issue. Thankfully this was on a staging site.

Also why do we have to write a function to do this? Why can’t we just type into the links css selectors field to add or remove filters from the list? Doing anything in functions.php is risky for the site.

Hey @simon,

this really sounds like a caching issue or something similar. I just used the filter to target a specific link selector and was able to change it afterwards without any issues.

Best,

André

Hi André,

I didn’t do this on an individual element as you did, I overwrote the entire list of selectors in my functions.php file, so:

add_filter( ‘bricks/link_css_selectors’, function( $link_css_selectors ) {
$link_css_selectors = [‘.link-wrapper a’, ‘.link-wrapper-2 a’];
return $link_css_selectors;
} );

I have purged the litespeed cache numerous times and deleted the website’s cache and history from my browser’s website data and any change I make to the selectors in the function, the changes are never applied.

Thanks,

Simon

Hey @simon,

still no issues whatsoever:

Best,

André

OK, I managed to get it sorted.

I’d read a topic on a similar vein to this and Stefan was saying to make a change in the theme styles to force a rebuild of the theme. I did this but it made no difference. Trying this again, I changed something this time in the Links theme settings and this did flush the change through (so changing the Links css selectors in functions.php a second time seems to need something in the Links theme settings changing, not in any other theme style section). This really needs to be documented but surely you shouldn’t have to do this.

It would be a lot easier if we didn’t have to use a function and could simply edit the selector list itself in the theme’s settings.

Hi Simon,
This is the thread you’re referring to:

You’re right :+1:

Since it’s basically about the same issue, I’ll close this thread.

Best regards,
timmse