Software Engineering in WordPress, PHP, and Backend Development

Category: Notes (Page 12 of 49)

Notes on programming-related problems that I’ve encountered while working on various projects.

Digest For February 28, 2016

I typically don’t post on Saturdays, and I usually let those who have signed up to receive emails via Postmatic get their summary via email once a week.

Time

But not everyone reads blogs the same way, and not everyone subscribes via email, so I thought I’d try something new. That is, this is an experiment (and I invite your critique at the end of the post).

With that said, here is a summary of the posts from this week.

Continue reading

Detecting Copy and Paste in JavaScript

Detecting copy and paste in JavaScript is not something that’s new to web development. How you do it may vary, though, depending on the set of tools you’re using.

Cut and Paste in JavaScript

Cut and paste, not cut and tape. And not like this.

Given I focus primarily on WordPress, the majority of the JavaScript I write uses jQuery. And though there are a number of ways you can go about doing this (which I’ll talk about later), some of them are deprecated (though they still work).

Anyway, so I was specifically looking for a way to handle the case where a user pastes content into a field using keyboard shortcuts.

Continue reading

Loading WordPress Tries to Download a File

Over the past few weeks, I’ve had a few clients contact me saying that their website won’t load. Instead, their current installation of WordPress tries to download a file whenever they access their site.

This doesn’t matter if you try to access wp-login.php, /wp-admin, or any of the usual directories. Further, if you look at the permissions on each of the files, everything looks in order.

WordPress File Permission Scheme

On top of that, there are no suspicious (read: malicious) files in place that would be redirecting a user’s request or anything like that.

So what gives?

Continue reading

The Difference Between Parameters and Arguments

When reading the documentation, reading technical articles, or dealing with anything programming related you’re going to come across both parameters and arguments.

Sometimes, people will use these phrases interchangeably. For what it’s worth, I think that’s okay. People know what the speaker or author is referring to when they are using these terms.

But there is a difference between the two. So if you find yourself in a situation – maybe an interview or a setting that requires a bit more precision – here’s the difference.

Continue reading

Touch a File (Before Creating It)

If you do any type of WordPress development for clients, then you’re likely familiar with having to work within many different environments.

Sure, the backend of each system may be very similar: That is, they are all running on some form of Linux with Apache or Nginx and MySQL. But, depending on the project that you’re working on, you may end up facing a variety of file permissions.

For example, let’s say that you’ve been hired to write a plugin or some custom functionality for someone and the work that you’re doing has to integrate with work that someone else has done. On top of that, it has to integrate with permissions on a file system that you can’t change.

Furthermore, a portion of the work you have to do must write a file to the disk. The problem? The code for saving a file isn’t working.

What then?

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑