- Actions (`add_action`): Trigger custom logic at lifecycle events (e.g. `init`, `wp_enqueue_scripts`). - Filters (`add_filter`): Intercept and modify data before it is saved or rendered (e.g. `the_content`).
php
add_action('init', function() {
register_post_type('portfolio', ['public' => true]);
});
add_filter('the_content', function($content) {
return $content . '<p>Footer note</p>';
});