Let’s continue developing our WP plugin for post autocomplete. Today, we will create a shortcode with an input field for the search query.
Generally speaking, there are two approaches to structuring plugin code:
- Use standalone functions to define hooks, filters, helpers, etc. In this case, it’s best to prefix each function name to avoid conflicts with other plugins/themes or WordPress core functions.
- Use class-based development. Here, you still need to use prefixes, but far fewer, since most logic is encapsulated in class methods.

