Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 200 of 219)

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

How To Find The Permalink By Slug in WordPress

If you're an advanced developer, then you may want to skip directly to the code.

As soon as you begin working on an advanced plugin or an application in which you try to maintain some form of solid cohesion (or even an API), then you end finding that there’s a function you need that isn’t available in the Codex.

This isn’t unique to WordPress. Any programming language that has a rich API ultimately has a set of solid features that allow you to build upon them to write more power functions.

For me, I try to publish most of my helper functions here on the site. It makes things searchable, available, and even available for code review for the more critical readers :).

Case in point: In a recent project, I needed to find the permalink by slug in WordPress and there wasn’t a function available to do exactly that, so here’s what I ended up doing.

Continue reading

Change the Email Sender in WordPress

If you're an experienced developer, you can skip to the code by clicking here.

If you’re in the business of hosting WordPress-based sites or at least managing WordPress-based sites, then it’s likely that you’re also responsible for managing email accounts or how email is relayed from the site and the server to its visitors.

And depending on the nature of your setup, this may not be a problem; however, if you’re operating on some type of hosted solution, some type of managed hosting, or aren’t using a third-party solution such as Google Apps, then there’s a chance that site visitors are receiving emails from their favorite WordPress-based site with incorrect or unclear email sender information.

Case in point: I manage a site where comment notification emails were being sent with the following formation:

[ Site Name ] [My Email Address] via [Server Name ]

Obviously, this is okay if it’s my site, but a client’s site? Negative.

Continue reading

Dynamically Creating a Custom Stylesheet For WordPress Plugins

For more technical users or to skip the the background explanation, skip directly to the code.

One of the challenges that comes with building WordPress plugins is supporting the conflicts that ensue with other poorly coded plugins and/or poorly coded themes.

It’s just the nature of the beast.

When it comes to addressing the way a plugin or widget looks on the frontend, I’ve often advised users to modify the plugin’s stylesheet in order to achieve the results they want.

Unfortunately, this is problematic for a number of reasons.

Continue reading

Contributing To WordPress 3.5

By nature, the idea behind open-source software is awesome: a group of people contributing their time to building something greater for others to use.

For the longest time, I’ve been someone who has often benefited from open source, but aside from contributing tickets, bug reports, or documentation, I’ve never actually contributed code to an open source project.

Contributing to WordPress 3.5 is the first time that I’ve ever contributed code to a project, and I couldn’t be happier that it’s on an application that’s such a significant part of my career.

Continue reading

Redirect Non-Administrators After Login in WordPress

For more technical users or to skip the the background explanation, skip directly to the code.

When it comes to building themes or plugins in WordPress, you rarely want administrators, editors, subscribers, and so on to anything other than the dashboard just after they’ve logged in.

After all, these authors are usually loggin in to write posts, edit their information, or generally manage their content.

But if you’re building a more advanced theme or an application, then allowing users to view the dashboard may be outside the scope of what you’re looking to allow.

As such, here’s an easy to redirect non-admin users to another page after logging into WordPress. Note that this post was updated on December 13, 2012 thanks to the recommendations in Simon’s comment.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑