How to Exclude a Post or Page from WordPress Search Results

I needed to have one post in a site I’m building not appear in search results. I came across this handy bit of code that totally does the trick, and it works for a page, too:

/** Exclude from search */
function mySearchFilter($query) {
if ($query->is_search) {
$excludeId = 199;
$query->set('post__not_in', array($excludeId));
}
return $query;
}
add_filter('pre_get_posts','mySearchFilter');

Copy and paste the above code in your theme’s Functions file:

Dashboard > Appearance > Themes > Editor > Functions.php

Then, replace “199” in this example with the ID of the page or post you want excluded. To find the ID, edit the page or post in the dashboard and look for this number:

postnumber

You might need to access the Functions.php file in your themes folder via FTP if you have a custom install.

This right here is one of the main reasons I love WordPress. Because it’s open source and so widely-adopted, chances are there’s a solution for whatever basic issue may arise. To find this result I just Googled, “How to exclude page in WordPress search” and was taken to this support discussion from several years ago. Even though it’s from a previous decade, the advice still worked, and I hope it might help you also.

What do you think? Have you ever been led to WordPress forums via Google search for a how-to type of question? How do you prefer to find answers to these issues? Let us hear from you in the comments.

A Funny Thing Happened On The Way To A Support Ticket

No ticket – not an option!  Buh-bye!

bluehost1

My web hosting company, Bluehost, has opted no longer to offer tickets for support. Instead, they are seeking to focus on chat and phone as primary communication channels for website issues.

As someone who has run sites for nearly two decades now, this is unheard of. On one hand, I absolutely understand how support tickets can be a bottomless pit for support staff, often containing not enough information to address an issue.

On the other hand, I’ve often enjoyed the convenience of opening a ticket then getting back to work while awaiting a response, then having it documented as the conversation progressed, sometimes with it being emailed back to me for future reference (from Bluehost & others).

I had an issue with my art website, RSMITHINGS.com this morning, and within 10 minutes I opened a chat session and it was resolved. Plus, I’ve had great help from Bluehost’s phone support in the past as well.

bluehost2

So in my own personal experience, not having tickets has been so far, so good. Still, this is a major shift in approach. I reached out to Bluehost support via Twitter for some details, and they confirmed the switch:

I have mixed feelings about this, but hey, if my issues can be resolved faster this way, I’m all for it.

What do you think? Do you prefer phone, chat or tickets for website tech support? Let us hear from you in the comments.

What Do You Do When A Song Is Stuck In Your Head?

MusicOnTheBrainI experience music looping in my head on a regular basis, and I’m sure you can think of several times this has happened to you. I’m also a self-taught musician, having learned to play guitar by ear from an early age through careful listening, so, I have a hunch my brain is more active in the “melody-analysis” area, and that I’m prone to experiencing this more often (or at a higher volume) than others. This doesn’t affect my life in any huge external way — I carry on productively and engaged in most any situation. But in a moment of relative quiet, the internal soundtrack often cranks right up.

But Isn’t That What Vocal Hooks Are For?

I’ve found it’s usually key phrases from songs that stand out — like dramatic flourishes or expressive riffs. It’s not always the “pop hook” or vocal element that grabs me, and it can be any obscure track from any time in history, of any genre, not just so-called “popular” music specifically music designed to lodge itself in the brain.

And then, after a few hours… it’s gone. Maybe I’ve made an effort to listen to the track somehow and exorcise its hold on my spirit. Or, what was there before just gets replaced by another track.

Rick Neilsen of Cheap Trick

Rick Neilsen of Cheap Trick – Power Pop Hook Maker Extraordinaire

Why Does This Happen?

Perhaps as early human cave dwellers, the ability to memorize sound served an evolutionary purpose. Hearing a growl in the distance might have prevented being eaten by a bear, so that would have been a good sound to repeat into memory for an advance warning next time. Or maybe hoofbeats in the distance signaled a tasty herd of beasts just over the ridge. I’m totally guessing, but it’s not implausible given what we understand about the fight-or-flight response.

What Do You Do?

I really wonder if there’s a course of action here. Is there some type of “resolution” or lesson to be learned — or does there even need to be? What purpose does having a song stuck in your head actually serve?

What do you think? Do you find that actually playing the song works to “release” the melody from your brain? Or do you find that songs usually dissipate on their own? Any guesses as to why this happens? Let us hear from you in the comments.

Space: Within our Reach… or, Redefining iCloud

A while back, I saw this news item about Lenovo & YouTube’s Space Lab project, and was reminded of an equally, if not more-so awesome father-son team who sent an iPhone into space by themselves. Best of all, they have video of it from start to end. It’s truly inspiring, gives iCloud a new meaning, and is worth a few minutes if you don’t mind being totally blown away.

Keith Richards’ “Life” Audiobook Review

Keith Richards LifeI just revisited the audiobook of Keith Richards‘ autobiography, Life, after having first listened some time ago. For me, the best parts were his thoughts about the magic of performance and songwriting, along with hearing the intimate details of how some of my favorite records like Exile on Main Street came together.

The parts where he gripes at length about Mick Jagger and Brian Jones got kinda tiresome, but I understand why they’re included, and the rest of the book more than makes up for it. For example, his unwavering respect and reverence of Charlie Watts is a constant theme. Also, the guy wrote Gimme Shelter, so, hey.

“Believe it or not, I remember everything”

I especially enjoyed the first half of the book, learning about Richards’ upbringing and what makes Keith, Keith. Hearing firsthand what it was like for a young rock ‘n roll band in the early ’60s and just how much these guys all revered American blues music was captivating and enlightening.

As for the audiobook itself, Keith narrates a few chapters at beginning and end; Johnny Depp does a few as well, and the majority is expertly read by Joe Hurley. They even won some formal recognition. All that aside, for an absolutely smashing one-on-one of the man himself doing the talking, definitely check out “Ask Keith” at Keith’s website.

Overall, this was a supremely compelling book, and I’d recommend it to anyone interested in the history of rock ‘n’ roll or even vaguely interested in the Stones. Because, bottom line: Keith is the real deal.

Musical accompaniment for this post:
Rocks Off, from Exile on Main Street

What do you think? Experienced any good audiobooks lately? What are your thoughts on the history of rock? Let us hear from you in the comments.