• Home
  • Plugins
    • BSK PDF Manager
    • BSK Forms Blacklist
    • BSK Forms Validation
  • Documentations
    • BSK PDF Manager
    • BSK Forms Blacklist
    • BSK Forms Validation
  • Blog
  • Contact Us
  • Your Account
    • Purchase History
    • Checkout

Action: bsk_pdfm_after_document_insert

All filters and hooks should be placed in your active theme’s functions.php file

bsk_pdfm_after_document_insert

 

Description

Use this hook to perform actions after a document inserted into base. The hook is triggered when a document is inserted by the way of BSK PDF Pro --> Add New.

 

Usage

add_action( "bsk_pdfm_after_document_insert", "do_sepcial_action_when_new_document", 10, 5 );

 

Parameters

  • $pdf_id integer. The id of the new inserted document.
  • $pdf_categories array. The id of the categories that the document is assigned.
  • $pdf_tags array. The id of the tags that the document is assigned.
  • $file_url string. The URL of the file, empty string if no file uploaded.
  • $extra_datas array. Extra data of the document, includes: title ( string), description ( string ), publish_date ( string ), expiry_date ( string ), status ( string ).

 

Example

Add new post and display the new document if its status is published.


add_filter( "bsk_pdfm_after_document_insert", "insert_post_and_display_the_document", 10, 5 );
function insert_post_and_display_the_document( 
                                       $pdf_id,
                                       $pdf_categories,
                                       $pdf_tags,
                                       $file_url,
                                       $extra_datas
                                   ) {

    if ( $extra_datas['status'] != 'published' ) {
        return;
    }

    $my_post = array(
	 'post_title'    => $extra_datas['title'],
	 'post_content'  => '[bsk-pdfm-pdfs-ul id="' . $pdf_id . '"]',
	 'post_status'   => 'publish',
    );
	   
    // Insert the post into the database
    wp_insert_post( $my_post );
}

Installation

  • How to install free version
  • How to install Pro version
  • How to upgrade to Pro version
  • Check version and update automatically
  • Update new version manually
  • Settings

    • Set Upload Directory
    • Multiple document formats
    • Featured image settings
    • Permalink settings
    • Sort PDFs / documents by date / title / custom / last modified
    • Hierarchical Category
    • Capability settings
    • User Available Categories
    • Embedded Viewer
    • Upload

      • Upload PDF / Document
      • Bulk Upload by FTP
      • Bulk add by Media Library
      • Generate thumbnail of PDF
      • Notification

        • Auto on new uploaded
        • Notify admin to approve PDF/document
        • Display all / specific

          • In list
          • In columns
          • In dropdown
          • Get specific PDFs' link only
          • Get specific PDFs' URL only
          • Display by category

            • In list
            • In columns
            • In dropdown
            • Display with category selector

              • In list
              • In columns
              • In dropdown
              • Embed PDF into Post / Page

                • Display PDF by embedding

                Hooks

                • Hooks

                FAQ

                • FAQ
  • Licensing
  • Refund Policy
  • Affiliate Area

 

Copyright © 2025 BannerSky

BannerSky