Software Engineering in WordPress, PHP, and Backend Development

Category: Notes (Page 31 of 50)

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

WordPress: Fatal Error Memory Exhausted

At some point, anyone building a theme, plugin, or even just working with WordPress has seen the Fatal Error: Memory Exhausted message. It typically reads something like this:

Fatal error: Allowed memory size is 268435456 bytes exhausted (tried to allocated 29596635 bytes) in …/wp-includes/wp-db.php on line 885.

Yes, your message may be a little different, but the point is the same: You see a fatal error, it has something to do with the amount of memory allowed, how much was attempted to be allocated, and what file threw the error.

In my opinion, one of the big problems with errors like this is that it’s far too easy to Google for a quick solution to fix the problem rather than truly understand the problem.

Sure, I understand we’ve got stuff to do and work to get done, but understanding what the problem may be is important to helping us become better developers, and, who knows, we may uncover a bug in a piece of open source software.

In this case, it’s not the latter, but here’s a good way to go about understanding the above error.

Continue reading

The scrollUp jQuery Plugin (And Placing The ‘Scroll To Top’ Button)

Whenever I’ve been asked to build a landing page or put a single-page site together for someone, one of the ways that I’ve occasionally implemented navigation is by using the scrollUp jQuery Plugin.

In short, it’s a simple plugin that gives a nice effect such that when the user clicks on a navigation link, the plugin will display a ‘Back To Top’ option in the bottom right corner of the screen.

Nothing too complicated, but it’s well implemented and I’m a fan. The thing is, sometimes the ‘Back To Top’ anchor can interfere with certain footer elements.

Continue reading

My WordPress Site Migration Process

Yesterday evening, I had to take some time to migrate my site to a new server because I had outgrown the service on which I started.

While doing so, I realized I’ve never bothered to share my WordPress site migration process.

Honestly, there’s nothing particularly unique about it. Furthermore, when it comes to deploying things to staging, I’ll often use tools that interface with my GitHub account to push out the differentials.

WordPress SIte Migration

Migrations. Not quite what we had in mind.

But when it comes to move a single site installation from one server to another, I typically follow the same process.

Continue reading

The WordPress Theme Customizer: Adding a New Setting To An Existing Section

Since the release of the WordPress Theme Customizer, my team and I have been more and more interested in using it as a way for users to make changes to the appearance of their theme without the use of the dashboard.

As powerful as the dashboard is, the “Appearance” section creates a disconnect between what the user toggles (or selects, or inputs, etc), and what they see on the front end.

The Theme Customizer mitigates that issue.

The thing is, there are a few nuances that come with implementing it in your theme. Though I’m not trying to cover everything here, the point of this post is show how you can introduce a new setting into an existing section.

Continue reading

How To Enforce Adding a Single Widget in WordPress

For a recent project, I needed to introduce functionality that added a widgetized area to the header of the blog, but only allowed a single instance of a specific widget to be added: the “Search” widget.

Since the dashboard for the widgetized areas are driven the by jQuery and jQuery UI libraries, the implementation is almost completely written in JavaScript, and although I know there may be some criticisms about only allowing a certain type of widget in a widgetized area, here’s how you can enforce adding a single widget in WordPress.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑