Delete option of a Plugin

WordPress will popup for FTP credentials if it does not have permission to write the files it needs to. Am assuming your WordPress website is hosted on Linux OS. And also if you connected to your server using SSH (i.e., putty, etc.). Please try to run the below command: sudo chown -R www-data:www-data /var/www/html Alternate … Read more

How to create a page with a form programmatically in WP?

You can use wp_insert_post() function with ‘after_theme_setup‘ action hook to programatically create pages. Here is a short example, add_action( ‘after_setup_theme’, ‘create_form_page’ ); function create_form_page(){ $title=”Form”; $slug = ‘form’; $page_content=””; // your page content here $post_type=”page”; $page_args = array( ‘post_type’ => $post_type, ‘post_title’ => $title, ‘post_content’ => $page_content, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_slug’ => … Read more

Settings API – format container of setting and setting’s description

It doesn’t seem possible to modify the <tr> tag, but for making it hidden by default (or initially hidden), then you can use the sixth parameter passed to add_settings_field(), which is $args: add_settings_field( ‘my_field’, // ID ‘My Field’, // Title ‘my_field_callback’, // Callback ‘my-setting-admin’, // Page/slug ‘setting_section_id’, // Section array( ‘class’ => ‘hidden’ ) ); … Read more

Download button in a plugin’s settings page

I managed to get the behaviour I was looking for with the following code : add_action(‘admin_menu’, ‘my_plugin_menu’); function my_plugin_menu() { add_menu_page(‘Plugin management’, ‘Plugin management’, ‘manage_options’, ‘my_plugin-plugin-settings’, ‘my_plugin_settings_page’, ‘dashicons-admin-generic’); } function my_plugin_settings_page() { if ( !current_user_can( ‘manage_options’ ) ) { wp_die( __( ‘You do not have sufficient permissions to access this page.’ ) ); } ?> … Read more