Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 149 of 219)

Articles, tips, and resources for WordPress-based development.

The WordPress Way (We’re Doing It Wrong)

For years, the whole “doing_it_wrong” meme has permeated the WordPress development community. Generally speaking, I think that it’s been toned down quite a bit in the last year or two and I consider that a good thing, but recently I’ve begun to see people say they are being chastised for not doing things “the WordPress way.”

You're Doing It Wrong

Granted, this may be something that’s been going on for far longer than I’m aware, but the fact that it’s beginning to reach a point at which we’re seeing a number of different people share this feeling in blog comments is, at the very least, interesting (if not a bit disconcerting).

Honestly, I’m of two minds about it: Telling someone they are “doing_it_wrong” is negative – it’s condescending. And perhaps telling people they aren’t doing it “the WordPress way” is just a flip side of the same coin, but I also think that it just has a more positive, approachable spin to it (depending on how it’s shared, I guess).

Whenever anyone starts off a discussion with a negative then proceeds to tell you why you’re wrong, you can’t help but feel a bit defensive and possibly even offended.

Using a more positive approach yields better conversation, doesn’t it?

And I think there’s something about “the WordPress way” that is more accessible and approachable. Though it still indicates that something isn’t being done correctly, it does come with the implication of “this isn’t the WordPress way, here’s how you should be doing it, and here’s why you should be doing it this way.”

And in that respect, it does matter whether or not we’re doing something correctly within the context of our software.

Continue reading

Debugging WordPress Projects with Log Files

There are a number of different ways that you can setup a debugging WordPress projects. It may be in the form of an IDE, it may be in the form of another application like MacGDBp, or it may be in the form of using something that fits your workflow.

Whatever the case, when a project reaches production, you normally don’t have access to any of the above. Instead, you’ve access to error logs. Obviously, they’re really useful when needing to, say, follow a stack trace for any given warning or error.

Sure, it sucks not being able to attach a debugger to your code on the server-side and then trace where the problem is, but given log files and pouring over enough information, you should be able to (well, at least hopefully) reproduce the error in both development and staging.

As such, I think it’s valuable not only to have quick access to error logs for WordPress in your staging environment but in your development environment, as well.

Continue reading

Resolving PHP Timeouts in WordPress

When it comes to working with long running scripts and WordPress, you’re usually at the mercy of one of two things:

  1. PHP configuration file
  2. The server’s PHP configuration

Granted, the case could be made that these are one and the same, and in a sense they are, but if you’re working with PHP on your local machine, you clearly have more control over the environment than when you’re working on a web server.

Technically, if you’re working on a dedicated server, you should have full control over the configuration of the environment.

If that’s not the case, this is article won’t be of much use; however, if you’re in the business of working with PHP scripts on your local machine and a shared server, and you’ve hit the maximum execution timeout message, then there are a few of ways to go about handling the problem.

Continue reading

Upload Files to the WordPress Media Library

Programmatically uploading files to WordPress is really just the same as uploading files from any source location to a destination.

That is to say, there are a number of PHP functions all of which make it pretty easy to deal with file-level operations, grabbing files from one location, and moving them to the next.

And yes, there are some nuances that can come with PHP’s configuration such that you may not be able to write to certain directories, perform certain options via HTTP, and so on. All of these can be managed by either changing up the configuration or by changing the way in which files are handled by the code.

The WordPress Media Library

One thing that WordPress offers that manual uploads don’t manage is adding files – specifically media types – to the Media Library after uploading a file. This is relatively easy to do given media_sideload_image.

But let’s say the situation is a little more complex.

Continue reading

Testing in WordPress: Scenarios and Spreadsheets

Testing software is one of those topics that people often talk about, write about (books even), and evangelize during conferences, meet ups, and so on. And rightly so – testing is one of the most important aspects of building something that’s going to be used by others.

Sometimes though, I wonder if we don’t do more talking about testing than actual testing.

By that, I mean we all understand its importance and I’d venture to say that we’re relatively familiar with the tools that are available for testing, but the act of testing in and of itself is kind of a beast:

  • It requires that you install additional software on to your computer
  • It requires that you learn how to write tests using the above software
  • It introduces more code thus more time into a project which doesn’t always translate well for stake holders
  • …and more

In short, there’s a lot working against it. I get it. Even more so, we talk about all kinds of testing – anything from unit tests to beta tests to release candidates and so on. All of these are important and they all have their place, and testing in WordPress is no different.

That said, there’s at least one method of testing that I think is applicable but rarely employed when it comes to creating themes or plugins. It’s an intermediate step of testing that I would say fits between user testing and beta testing: Use case testing (perhaps there’s a better title for it, but that’s what I have for this post).

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑