Error in pdf generating plugin using FPDF

The problem is that your output_pdf() function is being called too early. You have the function running in the root of the main plugin file, meaning that it runs as soon as the plugin is loaded, and before before WordPress has finished loading. You need to at least hook it to run later, such as … Read more

Changing menu order of a specific plugin in dashboard

I could see “WP Links Page” is a custom post type, so if it’s not registered by your own code, e.g. it’s registered by a plugin (using register_post_type()), then you can use the register_post_type_args filter to change the menu_position argument like so: add_filter( ‘register_post_type_args’, ‘my_override_register_post_type_args’, 10, 2 ); function my_override_register_post_type_args( $args, $post_type ) { // … Read more

wp-mail attachment is not sent for no reason?

I changed the code to this and it worked ! Don’t know why I should do this and this is very odd but whatever. function send_mail_to_admin($orderId , $attachment_img){ $attachment_img = str_replace(“https://seabou.com/wp-content” , “” , $attachment_img); $attachment_img = array( WP_CONTENT_DIR . $attachment_img ); $headers = array(‘Content-Type: text/html; charset=UTF-8′,’From: انجمن آبزیان <[email protected]>’); $body = “<html><body> <b style=”font-size:14px;direction:rtl;text-align:center;”>یک … Read more

Add type to enqueued script inside plugin

There’s a filter: script_loader_tag. add_filter( ‘script_loader_tag’, ‘wpse397773_change_script_tags’, 10, 3 ); function wpse397773_change_script_tags( $tag, $handle, $src ) { $tag = ‘<script type=”text/plain” src=”‘ . $src . ‘” id=”‘ . $handle . ‘-js”></script>’; return $tag; } This should change all the <script> tags in the page (assuming they’re properly enqueued) to <script type=”text/plain”>. Update: To only change … Read more

Can the uniqueness of the plugin file/plugin slug and version number be trusted?

Not really. There’s no 100% reliable way to guarantee that wordpress-seo/wp-seo.php on one site is the same plugin as wordpress-seo/wp-seo.php on another site, short of hashing the files, as you mentioned. It is highly unlikely that they are different plugins, but since there is no centralised system for registering unique plugin names, it cannot be … Read more