Plugin setting page – update_option problem

Your chunk of code if (isset($_POST[‘submit’])) { would process all the form submissions (even other forms which is not your settings page) which is why you are lossing your data. Even though this is not good way to create option page. But If you do something like if(is_admin() && isset($_POST[‘submit’]) && isset($_POST[‘ffita_gads_capub’])){…. could solve your … Read more

Save in my custom admin page and redirect to the saved object

You can call them with $last_item = $wpdb->get_row( “SELECT * FROM $wpdb->wp_puzzle ORDER BY your_table_id DESC LIMIT 1”, ARRAY_A ); and put manualy every item in your inputs at the form public function puzzle_manager(){ global $wpdb; $file = file_get_contents(‘puzzle_manager.php’, FILE_USE_INCLUDE_PATH); if($file == false){ echo ‘file not found’; } else{ echo $file; } $last_item = $wpdb->get_row( … Read more

Hiding WordPress REST endpoints from public viewing using Basic Authentication

Here is my solution. Inside the callback function I validate Authorization from the header like this: function callback_function($data) { //Get HTTP request headers $auth = apache_request_headers(); //Get only Authorization header $valid = $auth[‘Authorization’]; // Validate if ($valid == ‘Basic Base64UsernamePassword’) { //Do what the function should do } else { $response=”Please use a valid authentication”; … Read more

tweaking the

the answer (taken from: https://stackoverflow.com/questions/36087390/add-filterwp-title-doesnt-replace-my-title-tag-wordpress-plugin) was to do this: add_filter( ‘pre_get_document_title’, ‘vendor_module_filter_the_title’, 999, 1 ); this is due to the YOAST SEO plugin and the above is the found workaround.

Add new header/footer on landing page with plugin

You can intercept the template WordPress will be using with the template_include filter. Like this: add_filter (‘template_include’,’wpse303537_plugin_template’, 10,1); function wpse303537_plugin_template ($template) { if (is_front_page) $template = plugin_dir_path( __FILE__ ) . ‘/my-template.php’; return $template; } Alternatively, you can include an almost empty template for the landing page in your theme and fill it through the action … Read more