Configure WordPress to Generate Scheme-less Relative URLs

You can use the style_loader_src and script_loader_src filters. namespace WPSE; \add_filter( ‘style_loader_src’ , __NAMESPACE__ . ‘\protocol_relative-url’ ); \add_filter( ‘script_loader_src’, __NAMESPACE__ . ‘\protocol_relative-url’ ); function protocol_relative_url( string $url ) : string { return str_replace( [ ‘http:’, ‘https:’ ], ”, $url ); } /* Notes: * Namespaces require PHP > 5.3 * [] array syntax requires PHP … Read more

Custom Plugin Options Won’t Update

Did you confirm it was the transient values causing the options to not update? Here’s the WordPress function to clear transient values: https://codex.wordpress.org/Function_Reference/delete_transient An example: <?php // Create a simple function to delete our transient function edit_term_delete_transient() { delete_transient( ‘the_transient_name_to_delete’ ); } // Add the function to the edit_term hook so it runs when categories/tags … Read more

Issue with plugin sub menu and pages

Your code has a syntax error, extra close-curly in new_menu(). Your test_sub_menu() function has all the vars that are used in new_menu() – but they’re not global or called to from new_menu(), so they do nothing and the functions do nothing but return undefined errors. $parent_slug = ‘new-menu’; should be instead, for a subpage, the … Read more

show my own admin_notices after a post has been published

Add Additional ‘Published’ Notices You can use the following to add an additional admin notice after a post has been published: add_action(‘admin_notices’, function(){ $screen = get_current_screen(); $editPostScreen = ($screen->parent_base == ‘edit’ && $screen->post_type == ‘post’) ? true : false; $justPublished = (isset($_GET[‘message’]) && $_GET[‘message’] == ‘6’) ? true : false; if ($editPostScreen && $justPublished) { … Read more

how to save wp_editor html content in options table

echo ‘<form action=”” class=”booked-settings-form” method=”post”>’; $default_content=”<p>Mail formate</p>”; $editor_id = ‘customerCleanerMail’; $option_name=”customerCleanerMail”; $default_content=html_entity_decode($default_content); $default_content=stripslashes($default_content); wp_editor( $default_content, $editor_id,array(‘textarea_name’ => $option_name,’media_buttons’ => false,’editor_height’ => 350,’teeny’ => true) ); submit_button(‘Save’, ‘primary’); echo ‘</form>’; if(isset($_POST[‘customerCleanerMail’]) ){ $var2=htmlentities(wpautop($_POST[‘customerCleanerMail’])); $fff=update_option(‘customerCleanerMail’, $var2); } In form section i used wp_editor with his options, wp_editor work like html editor but when you store these data … Read more