Comenzar un plugin de WordPress

<?php
/**
 * Plugin Name:       Your Theme Core
 * Description:       Core functions
 * Requires at least: 6.6
 * Requires PHP:      7.0
 * Version:           0.1.0
 * Author:            Flavia Bernárdez Rodríguez
 * License:           GPL-2.0-or-later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       your-theme-core
 *
 * @package CreateBlock
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/* Add Excerpt in Pages */
function your_theme_core_enable_excerpt_for_pages() {
          add_post_type_support('page', 'excerpt');
}
add_action('init', 'your_theme_core_enable_excerpt_for_pages');

/* Deactivate all images sizes */
add_filter( 'intermediate_image_sizes', '__return_empty_array' );

/**
 * Allow SVG uploads in WordPress
 */
function your_theme_core_allow_svg_uploads($mimes) {
	// Add support for SVG
	$mimes['svg'] = 'image/svg+xml';
	return $mimes;
}
add_filter('upload_mimes', 'your_theme_core_allow_svg_uploads');

/**
 * Check and fix MIME type for SVG
 */
function your_theme_core_check_svg_mime_type($data, $file, $filename, $mimes) {
	$ext = pathinfo($filename, PATHINFO_EXTENSION);
	if ($ext === 'svg') {
		$data['ext'] = 'svg';
		$data['type'] = 'image/svg+xml';
	}
	return $data;
}
add_filter('wp_check_filetype_and_ext', 'your_theme_core_check_svg_mime_type', 10, 4);

/**
 * Fix for displaying SVGs in the Media Library
 */
function your_theme_core_fix_svg_display() {
	echo '<style>
        .attachment-266x266, .thumbnail img {
            width: 100% !important;
            height: auto !important;
        }
    </style>';
}
add_action('admin_head', 'your_theme_core_fix_svg_display');

/**
 * Allow SVG preview in Media Library
 */
function your_theme_core_svg_mime_display($response, $attachment, $meta) {
	if ($response['mime'] == 'image/svg+xml') {
		$response['sizes'] = array(
			'full' => array(
				'url' => $response['url'],
				'width' => $meta['width'],
				'height' => $meta['height'],
			)
		);
	}
	return $response;
}
add_filter('wp_prepare_attachment_for_js', 'your_theme_core_svg_mime_display', 10, 3);

/**
 * Disable JPEG image compression
 */
function your_theme_core_disable_image_compression_quality($quality) {
	return 100; // Set the quality to 100 to disable compression for JPEG
}
add_filter('jpeg_quality', 'your_theme_core_disable_image_compression_quality');

/**
 * Disable WebP image compression
 */
function your_theme_core_disable_image_compression_quality_webp($quality, $mime_type) {
	if ('image/webp' === $mime_type) {
		return 100; // Set the quality to 100 to disable compression for WebP
	}
	return $quality;
}
add_filter('wp_editor_set_quality', 'your_theme_core_disable_image_compression_quality_webp', 10, 2);