PHP code example of builtnorth / wp-baseline

1. Go to this page and download the library: Download builtnorth/wp-baseline library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

builtnorth / wp-baseline example snippets


if (class_exists('BuiltNorth\WPBaseline\App')) {
    $baseline = BuiltNorth\WPBaseline\App::instance();
    $baseline->boot();
}

add_filter('wpbaseline_disable_comments', '__return_true');

add_filter('wpbaseline_howdy_text', function ($text) {
    return 'Hey,';
});

add_filter('wpbaseline_clean_admin_bar', '__return_false');

add_filter('wpbaseline_remove_dashboard_widgets', '__return_false');

add_filter('wpbaseline_disable_emojis', '__return_false');

add_filter('wpbaseline_disable_update_emails', '__return_false');

define('YOUR_THEME_VERSION', '1.2.9');
add_filter('wpbaseline_asset_version_constant', function () {
    return 'YOUR_THEME_VERSION';
});

add_filter('wpbaseline_enable_security_headers', '__return_false');

// Modify security headers
add_filter('wpbaseline_security_headers', function($headers) {
    // Customize headers
    $headers['X-Frame-Options'] = 'DENY';
    return $headers;
});

add_filter('wpbaseline_login_security', '__return_false');

add_filter('wpbaseline_disable_user_rest_endpoints', '__return_false');

add_filter('wpbaseline_disable_xmlrpc', '__return_false');

add_filter('wpbaseline_enable_svg_uploads', '__return_false');

add_filter('wpbaseline_enable_json_uploads', '__return_true');

add_filter('wpbaseline_sanitize_json_uploads', '__return_true');

add_filter('wpbaseline_enable_lottie_uploads', '__return_true');

add_filter('wpbaseline_validate_lottie_uploads', '__return_false');

add_filter('wpbaseline_lottie_max_file_size', function() {
    return 5 * 1024 * 1024; // 5MB
});

// Disable duplicate post functionality entirely
add_filter('wp_baseline_duplicate_post_config', function($config) {
    $config['enabled'] = false;
    return $config;
});

// Limit to specific post types
add_filter('wp_baseline_duplicate_post_config', function($config) {
    $config['post_types'] = ['post', 'page', 'product'];
    return $config;
});

// Disable for specific post types
add_filter('wp_baseline_duplicate_post_config', function($config) {
    // Get all public post types
    $post_types = get_post_types(['public' => true]);
    // Remove the ones you don't want
    unset($post_types['attachment']);
    $config['post_types'] = array_keys($post_types);
    return $config;
});