Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 9 of 219)

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

Quick Tip: Show All Users Sorted by Metadata

In the previous post on sorting users by meta data, I concluded with the following:

Note that how the status is set will depend on the plugin you’re working on and whether or not you want to render a column on the All Users page for this. And I can show that in another tip in a future post.

By this, I mean that it’s one thing to actually sort the users on the All Users page but it doesn’t make a lot of sense unless there’s a column by which the status is shown and the value of said status.

Given that, here’s how we can show all users sorted by the metadata that we reviewed in the previous post.

Continue reading

Quick Tip: Sort All Users by Metadata

If you’re working with the All Users screen in WordPress and want to sort all users by metadata, it’s possible with the pre_get_users hook.

In WordPress, though, there’s a handful of pieces of data that you’ll need to work with this hook. Namely:

  • the meta key off of which you want to read the information,
  • how you want to order the query,
  • and how to set up the meta query.

Additionally, if you just want to run the query on the All Users page, it’s helpful to prevent the query from running except for where you want it.

Continue reading

A Backend Engineer Learns to Build Block Editor Blocks, Part 2

I ended the last article with a functioning block that shows one thing in the editor and another thing on the frontend. The reason for doing so was so we could see how to put together the basic foundation of a plugin for the Block Editor.

Now that we’re at this point, it’s much easier to start talking about things related to the Editor, things related to the frontend, how to start serializing data, how to start reading data, and so on. But because I’m trying to do this entire series as a backend engineer creating blocks – which is generally delegated to frontend development – I want to take it step by step.

In the last article, I wrote:

[T]he thing we’re going to look at doing next is adding styles for both the frontend and the editor and some basic functionality to the block.

As I continue to write about learning to build block editor blocks, we’ll continue with looking at adding styles to both the backend and the frontend.


In this article, we’re going to cover:

  • adding controls to the block in the editor so we can control its placement within WordPress itself (or even remove it from the editor),
  • ensuring what we see in the editor is what we see on the frontend

Like last time, there are going to be things we have to dive into that will require reference material and links to external resources. But consider that part of the journey of learning to build blocks.

Continue reading

Dracula Theme for Preformatted WordPress Blocks

When working on the articles for the Backend Engineer Learns to Build Block Editor Blocks series, I wasn’t happy with how the code samples were looking within the articles.

Previously, I’ve written – here and here – about my being a fan of the work done by Zeno Rocha in the Dracula Theme. Ideally, I wanted to be able to have the color scheme of the code in my articles match the theme. Something like a Dracula Theme for WordPress Blocks.

That’s when I found highlight.js and a Dracula theme for it. So I wrote a small plugin for WordPress that works with the existing Preformatted block and changes the color scheme to match that of Dracula.

I call it WP Dracula Highlight.js or, more simply, Dracula Highlight.

Continue reading
« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑