Click to Play

PayPal's New Toolkit for Google...
PayPal made some cloud computing advancements at Google I/O by announcing its X Toolkit for Google App Engine (GAE). WebProNews spoke...

Recent Articles

How To View And Edit Your Whois Data To Increase SEO
This is only one SEO tip out of many search engine optimization tips I have been providing over the years. All of my search engine optimization tips are meant to be specific, they should not take too much time...

Adding Extra Social Media Connections With...
I've been inspired by your Facebook fan page, Dave, and have one of my own. Now that I have it, though, I'd like to be able to inclue a "like" box on my blog so that people not only see a link to the fan page...

Adjusting Your Live Website Using Webmaster...
OK, so you've got your site set-up and configured in Google Webmaster tools. Now it's time to start looking at the data. Your Site on the Web. Google Webmaster Tools allows you to view some basic stats and...

How To Initially Set Up Your Website
hAll right beginners pay attention and I'll instruct you "How To Set Up A Web Page Free"!!! There are a lot of sites out there that make you believe that they are going to give you free website or free web addresses or free something or the other. What you don't...


06.03.10

How To Debug Your WordPress Upgrade

By Alister Cameron

This week I upgraded a new client's WordPress blog from version 2.6 to 2.9.2. All went just dandy. Then today he emailed me to say that he'd noticed his post excerpts were not appearing where they were supposed to, in single post pages.

On closer inspection I noticed that the excerpts displayed fine on the homepage, but - despite the same exact code being used - they weren't showing up on single post pages. In both cases the the_excerpt() function was being used without parameters. Weird.

How would you go about debugging this one?

My immediate thought was to blame a plugin. Why? Because WordPress's great coding strength is also its weakness - hooks and filters give plugin authors the ability to mess with the output of "core" WordPress functions. But it's really hard to tell if any messing around is going on, in order to debug problems.

Question then: how do you figure out if one or more plugins is using a hook/filter to mess with the output of a given WordPress function?

If you have shell access to your WordPress host I've got a little treasure for you today. A simple enough shell command that will make your life a lot easier. (If you're a "real" programmer you'll almost certainly know about this already, but if you're not, you're gonna love it!)

Now, shell access (SSH) gives you "command-line" control of the operating system on which your WordPress blog resides. If your hosting provider has given that to you and you know how to use it, you can do cool stuff like ZIP up all the content in one hit so you can back it up really easily, say. Lots of fun to be had.

Today I want to show you how to return search results for all the instances where a certain string appears in your plugins' PHP files. That's how we're going to debug my problem with the the_excerpt() function today.

Here's the command to run at your SSH prompt when you've navigated into your wp-content/plugins directory:

find . -name \*.php -exec grep mystringhere {} +

(Note that on older systems that last plus sign might need to be replaced with a semicolon ";".)

That command simply isolates all php files and searches through each in turn for each occurrence of "mystringhere". For each occurrence it finds, it shows you that line of code preceded by the filename and line number. Easy!

Because I don't like the black and white of my Terminal application, I then copy out all the results found into my code editor, so that I get to see the code in all the pretty colours that Coda puts it in. That's up to you.

For purposes of example, here are the results I got from my client's plugin directory(pops up a new window).

Yes it looks like a huge mess, but you can see now that it's really easy for me, in my code editor, to search through all that for "add_filter" and "add_action", to see where any plugin is messing with the output of the the_excerpt() function.

Continue reading this article.


About the author:
Alister Cameron is an accomplished web designer and internet marketing consultant who turns established subject-matter experts into expert bloggers. Alister's clients are using blogging and social media to leverage their offline expertise in the online world, and engage Alister to build their blogging platform or social network; to train them in writing and online marketing strategy; and to help them stay up with the latest developments in blogging and online marketing. Alister's blog is a rich tapestry of advice, anecdotes and reflections from the frontline of professional blogging, social media and search engine marketing, and never without generous dollops of humor and wit.
About DevWebProAU
DevWebProAU is for professional developers ... those who build and manage applications and sophisticated websites. DevWebProAU delivers via news and expert advice New Strategies In Development.





DevWebProAU is brought to you by:

SecurityConfig.comNetworkingFiles.com
NetworkNewz.comWebProASP.com
DatabaseProNews.comSQLProNews.com
ITcertificationNews.comSysAdminNews.com
LinuxProNews.comWirelessProNews.com
CProgrammingTrends.comNetworkNewz.com






-- DevWebProAU is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2010 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal  

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


Delivering IT Solutions DevWebProAU News Archives About Us Feedback DevWebProAU Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact