Ollie Block Academy

Completing Our Block

Registering a custom block category – C

This lesson covers advanced category positioning using array_splice() to insert custom categories at precise locations within the block inserter. You’ll learn to loop through existing categories with foreach, identify target categories by slug, and use array_splice() with proper offset, length, and replacement parameters.

The technique allows inserting your category after any existing category (like “text”) by finding the index, adding one for positioning, and breaking the loop after modification.

This method provides granular control over category placement, ensuring your blocks appear exactly where you want them in the inserter interface.

Back to: Ollie Block Academy > Completing Our Block