Shortcode returning localized HTML part

Using your comments, I found what I was missing. I initialized my textdomain with : add_action(‘admin_init’, ‘related_post_shortcode_init’); function related_post_shortcode_init() { load_plugin_textdomain(‘related-post-shortcode’, false, basename( dirname( __FILE__ ) ) . ‘/i18n’ ); } So, the textdomain was ok and ready for back-office translations (admin_init), but not for front, as @Mark Kaplun suggested. I simply added another hook … Read more

You do not have sufficient permissions to access this page on a submenu

Continued to do more research and ended up finding the solution to my problem! Since the url I am passing the parameter to is /wp-admin/admin.php?page=ecosystem-delete. I didn’t even notice that ?page=ecosystem-delete is already a parameter, so I needed to pass my second parameter into the URL as &id= rather than ?id=. A simple overlooked mistake. … Read more

Update problem with update_option() in combination with register_setting()

Note what happens when you provide sanitize callback in register_setting(). It register a filter to sanitize your options add_filter( “sanitize_option_{$option_name}”, $sanitize_callback ); Now when you do update_option() then trigger your own function to prevent saving 😀 Because update_option() calls $value = sanitize_option( $option, $value ); Solution: Remove register_settings() callback before you call update_option(). function gtp_remove_installing_data() … Read more

Putting a resized image into media library with wp_get_image_editor(

You need the generate_filename method of the image editor class. Like this: $filename = $img->generate_filename( ‘resized’, ABSPATH.’wp-content/uploads/resized-images/’); $image->save($filename); This will save the image, renamed originalname-resized, in the resized-images directory of the upload folder. This does not mean WordPress knows it is there. That depends on the context in which you are calling wp_get_image_editor().