Jest Testing Best Practices: Implementation Tests vs Behavior Tests Explained

When you write a Jest test for a Gutenberg block’s save function, there are usually two paths you can take: test what was called, or test what got rendered. They look similar on the surface, but they lead to very different test suites. Approach 1: Testing Implementation Details This test checks that useBlockProps.save was called… Continue reading Jest Testing Best Practices: Implementation Tests vs Behavior Tests Explained

WordPress Performance Optimization: 15 Hooks Every Enterprise Developer Should Know

If you’ve worked on enterprise WordPress for any length of time, you already know the truth: performance problems rarely come from one big bottleneck. They come from a hundred small ones stacked on top of each other — an unindexed meta query here, a Heartbeat request every 15 seconds there, an unnecessary found_posts count on… Continue reading WordPress Performance Optimization: 15 Hooks Every Enterprise Developer Should Know

How to change custom post type slug without loosing data

Sometime it happens, that at first we create custom post type, register taxonomy and insert some data for that custom post type. After moving forward, then we realise that, we need to change the slug for that custom post type. There might be some reason for this. Whatever the reason is, when we change the… Continue reading How to change custom post type slug without loosing data

WordPress Query Basics

Show all posts from a custom post type WordPress has a small function get_posts() to do this job. You just need to set your arguments and pass that argument inside the function. It returns an array of latest posts. You can use foreach function to loop though the returned array. Show all posts for a… Continue reading WordPress Query Basics