Category: Uncategorized

  • Basic repository protection in BitBucket

    One of the basic but critical tasks in any project is protecting the repository. Depending on the project, this can become quite complex, especially when CI/CD pipelines are involved.

    Here I want to show a simple and effective approach that can significantly reduce risks and help prevent accidental or dangerous changes.

    The core idea is straightforward: protect the main (or master) branch. Any changes to this branch should only be possible via pull requests.

    (more…)
  • I came up with the post format for myself.

    It’s difficult to start writing. I’ve seen many blogs that started great. Lots of posts, structure, thoughtful content. But it quickly ended. The author couldn’t keep it up for long. I’m probably on my 6th or 7th attempt myself. I have the desire, and even the opportunity, but I stop doing it.

    I’ve thought about this a lot. Why is that? Why can’t I, a WordPress website developer, whose platform is designed for blogging, maintain my own blog? I have ideas and experience in web development. A blog seems like a great extension of my work, a way to preserve information. It’s also an opportunity to share personal thoughts or approaches with colleagues and the world. Theoretically, it’s also a way to showcase my expertise to potential clients. All advantages. But why don’t I do it?

    After much reflection, I understood. I have a kind of perfectionism. I think too much about each article or post. I consider it perfect and unchangeable. I don’t allow myself to make mistakes. I don’t allow myself to do something simple and obvious to me. It seems like everything has already been written and there’s no point in doing it. I don’t want to look like someone who tries for the eighth time, thinks everything will work out, and then gives up. It looks like weakness.

    Having made this conclusion, I realized that I need a different strategy here. It’s about writing simpler, faster, not being afraid of mistakes, and simply generating content from my current life. Learned something in Azure? Show it. Found an approach that seems great in theme.json? Write a post about it. It can be short, or unstructured. Or even wrong, and then you’ll change your mind and won’t think that way anymore. But that’s the only way it’s possible. Let companies with managers and resources handle polishing articles. I don’t have time to write something for a long time. It seems any reasonable busy person understands this.

    So I started with this explanation, probably to myself first and foremost. I hope I continue.

  • Using Strings Instead of Variables in WordPress Functions

    The official WordPress documentation recommends registering CPTs this way

    register_post_type( 'book', $args );

    This works fine. But sometimes we want to register it via a variable. For example, to do it in a class. Here is an example

    
    class Book_Post_Type {
    	private string $type = 'book';
    
    	public function __construct() {
    		add_action( 'init', [ $this, 'register' ] );
    	}
    
    	public function register(): void {
    		register_post_type( $this->type /* , $args */ );
    	}
    }

    This all works as well. Thinking about extending this class, it looks good. We can use $this->type here and not duplicate this variable.

    From an OOP perspective, this is not bad, and looks like a best practice, but it seems to me that from a WordPress perspective, this is not so.

    Why is that? When we do not use the string directly, it will be much more difficult to find everything related to this CPT and where it is used. From a long-term observation point of view, it looks like doing a search on the project, you can find all functions related to this CPT.