If you’ve profiled a WordPress archive page with Query Monitor, you’ve probably seen this pattern without knowing what it was: Two queries, back to back, for the exact same batch of post IDs. One fetches the posts. The second – often slower, despite doing “less” – fetches metadata nobody asked for. That second query is… Continue reading Optimize WP_Query Performance: Skipping Meta Cache Priming the Right Way
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
Enterprise WordPress Performance: Smarter postmeta Key Design
Every WordPress developer has written a WP_Query with a meta_query argument. It feels natural. But at enterprise scale — hundreds of thousands of posts, millions of rows in wp_postmeta — those queries become some of the heaviest load your database carries. The good news: a significant slice of that cost is avoidable with a shift… Continue reading Enterprise WordPress Performance: Smarter postmeta Key Design
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 use option panel data for a custom field with ACF
With the help of ACF you can create custom fields for specific use cases of any registered post type in your site. After that you can insert data from the edit screen of a single post and update. If you are using a checkbox for any of your custom fields then you have to define… Continue reading How to use option panel data for a custom field with ACF
Create a WordPress option page with ACF
When you are developing a theme or plugin, you might need to have an option page for your theme or plugin settings. Its is very easy to have that page with the help of ACF ( Advance Custom Field ) plugin. You also need to have pro version of this plugin to working properly. Let’s… Continue reading Create a WordPress option page with ACF
How to localize a script in WordPress
Before we localize a script, we need to register a script first. Because without this, we can not localize any script. Because to localize a script, we need a registered script handle. Here is the syntax to register a script. wp_enqueue_script( $handle:string, $src:string, $deps:array, $ver:string|boolean|null, $in_footer:boolean ) wp_enqueue_script( ‘myjs’, ‘path_to_js_file’, array( ‘jquery’ ), ‘1.0’, true… Continue reading How to localize a script in WordPress
WordPress Trips and Tricks – Part 1
How to show archive title instead of first post of custom post type When you create a template of your custom post type for the archive data, you might need to display archive title. But by default first post title comes up. To solve this type of problem WordPress has a function named post_type_archive_title() .… Continue reading WordPress Trips and Tricks – Part 1
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