WordPress Built in Function

By | October 13th 2018 05:15:32 PM | viewed 172 times
Built-in theme function

1.Show Header

get_header()

2.Show Footer

get_footer()

3. About Post

       // Start the loop.
	while ( have_posts() ) : the_post();

			// Include the page content template.
			get_template_part( 'content', 'page' );

			// If comments are open or we have at least one comment, load up the comment template.
			if ( comments_open() || get_comments_number() ) :
				comments_template();
			endif;

		
	endwhile;
	  // End the loop.

4. Query on specific post

		$args =  array(
		'posts_per_page' => '-1',
		'post_type' => 'products'
		);
		$myProducts = new WP_Query( $args );
		
				while ( $myProducts->have_posts() ) : $myProducts->the_post();
			       get_template_part( 'content', get_post_format() );
				endwhile;
				
				wp_reset_postdata();

5. Custom query

   global $wpdb;
   $results = $wpdb->get_results( 'SELECT a.name FROM wp_terms a,wp_term_taxonomy b,wp_term_relationships c WHERE a.term_id=b.term_id and b.term_taxonomy_id= c.term_taxonomy_id and c.object_id ='.get_the_ID().'');

6. Show Content.

   the_content();
   get_the_content();

7. Get Post Id

  get_the_ID()

8. Home Page

      is_home()

9. Front Page

     is_front_page()

10. Single post

      is_single()

11. Single Page Title

     single_post_title()

12. Page Title

    the_title()

13. Display Feature Image

    the_post_thumbnail( array( 100, 100 ) );
	the_post_thumbnail( 'medium' );        // Medium resolution (300 x 300 max height 300px)
	the_post_thumbnail( 'medium_large' );  // Medium Large (added in WP 4.4) resolution (768 x 0 infinite height)
	has_post_thumbnail($post->ID)
	get_the_post_thumbnail($post->ID)

14. Display all custom field

    the_meta();

15. Display specific custom field information

      // Get a specific custom field information
   echo get_post_meta( $post->ID, 'movie type', TRUE );   // post id, custom_field_name, $single boolean value
			   

16. add_post_meta() || Add meta data field to a post

      add_post_meta( int $post_id, string $meta_key, mixed $meta_value, bool $unique = false )
			   

17. add_meta() || Add post meta data defined in $_POST superglobal for post with given ID

  add_meta( int $post_ID )

18. add_metadata() || Add metadata for the specified object.

 add_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value, bool $unique = false )

19. Display combobox of custom field

      Custom Field Rating: 
       esc_html( get_post_meta( get_the_ID(), 'movie_rating', true ) )			   

20. add_meta_box() || Adds a meta box to one or more screens.

      add_meta_box( string $id, string $title, callable $callback, string|array|WP_Screen $screen = null, string $context = 'advanced', string $priority = 'default', array $callback_args = null )		   

21. To show advanced field value.

   get_field('field_5b69fa7399d20')
   /*or wordpress 5.0*/
   get_post_meta( post_id, 'field_name', TRUE )

22. To show advanced field image.

   get_field('field_5b69fa7399d20')['url']
   /*or wordpress 5.0*/
    get_field('fiels_name',post_id)['url'];

23. Previous/next page navigation.

     the_posts_pagination( array(
				'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
				'next_text'          => __( 'Next page', 'twentyfifteen' ),
				'before_page_number' => '' . __( 'Page', 'twentyfifteen' ) . ' ',
	 ));

24. To show category list.

    $category_list = wp_list_categories( array(
	  'taxonomy' => 'ukmcategory',
	  'orderby' => 'name',
	  'show_count' => 0,
	  'pad_counts' => 0,
	  'hierarchical' => 1,
	  'echo' => 0,
	  'title_li' => 'Category'
  ) );

   // Make sure there are terms with articles
if ( $category_list )
  echo '
    ' . $category_list . '
'; /*or custom query */ global $wpdb; $results = $wpdb->get_results( 'SELECT distinct a.name,a.term_id FROM uk_terms a,uk_term_taxonomy b WHERE a.term_id=b.term_id and b.taxonomy="resturent_menu" and b.parent=0 order by a.name asc'); // parent category menu foreach($results as $resu){ echo $resu->name; echo $resu->term_id; echo get_field('sample_image', 'resturent_menu_'.$resu->term_id)['sizes']['medium']; // custom image of 'resturent_menu texonomy } if(! empty($tid)){ $submenu = $wpdb->get_results( 'SELECT distinct a.name,a.term_id,b.description FROM uk_terms a,uk_term_taxonomy b WHERE a.term_id=b.term_id and b.taxonomy="resturent_menu" and b.parent="'.$tid.'"order by a.name asc'); // child category menu }

25. To show menu.

	
		if ( has_nav_menu( 'primary' ) ) : 
					wp_nav_menu( array(
						'menu_class'     => 'nav-menu',
						'theme_location' => 'primary',
					));
		 endif; 		

26. dynamic_sidebar() || Display dynamic sidebar.

        //dynamic_sidebar( int|string $index = 1 )
	    if ( is_active_sidebar( 'sidebar-1' ) ) : 
				dynamic_sidebar( 'sidebar-1' ); 
		 endif;

27. For hyperlink.

   the_permalink()

28. home page url

   esc_url( home_url( '/' ) )

29. bloginfo() || site name

   bloginfo( string $show = '' )

30. get theme directory

  get_bloginfo('stylesheet_directory').'/images/down.png'
  get_bloginfo('template_directory') . '/images/down.png'

31. add dashboard widget

  wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback, $callback_args )

32. add copyright at footer

  function wpb_copyright() {
	global $wpdb;
	$copyright_dates = $wpdb->get_results("
	SELECT
	YEAR(min(post_date_gmt)) AS firstdate,
	YEAR(max(post_date_gmt)) AS lastdate
	FROM
	$wpdb->posts
	WHERE
	post_status = 'publish'
	");
	$output = '';
	if($copyright_dates) {
	$copyright = "© " . $copyright_dates[0]->firstdate;
	if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
	$copyright .= '-' . $copyright_dates[0]->lastdate;
	}
	$output = $copyright;
	}
	return $output;
 }

After adding this function, you’ll need to open your footer.php file and add the following code wherever you like to display the dynamic copyright date:

 echo wpb_copyright();

33. Randomly Change Background Color in WordPress

First you need to add this code to your theme’s functions file.

  function wpb_bg() { 
	$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
	$color ='#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].
	$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
	echo $color;
}

Next, you’ll need to edit the header.php file in your theme. Locate the tag and add replace it with this line:

<body <?php body_class(); ?> style="background-color:<?php wpb_bg();?>">>

34. Update WordPress URLs

One way to do this is by using wp-config.php file. However, if you do that you will not be able to set the correct address on the settings page. The WordPress URL and Site URL fields will be locked and uneditable

If you want to fix this, then you should add this code to your functions file.

  update_option( 'siteurl', 'http://example.com' );
  update_option( 'home', 'http://example.com' );

Don’t forget to replace example.com with your own domain name.

35. Add Additional Image Sizes in WordPress

WordPress automatically creates several image sizes when you upload an image. You can also create additional image sizes to use in your theme. Add this code your theme’s functions file.

  add_image_size( 'sidebar-thumb', 120, 120, true ); // Hard Crop Mode
  add_image_size( 'homepage-thumb', 220, 180 ); // Soft Crop Mode
  add_image_size( 'singlepost-thumb', 590, 9999 ); // Unlimited Height Mode

You can display an image size in anywhere in your theme using this code

<?php the_post_thumbnail( 'homepage-thumb' ); ?>

36. register_nav_menus( array $locations = array() ) || Add New Navigation Menus to Your Theme

WordPress allows theme developers to define navigation menus and then display them. Add this code in your theme’s functions file to define a new menu location in your theme.

  function wpb_custom_new_menu() {
  register_nav_menu('my-custom-menu',__( 'My Custom Menu' ));
 }
  add_action( 'init', 'wpb_custom_new_menu' );

Now you need to add this code to your theme where you want to display navigation menu.

<?php wp_nav_menu( array( 'theme_location' => 'my-custom-menu', 'container_class' => 'custom-menu-class' ) ); ?>

37. register_sidebar() || Builds the definition for a single sidebar and returns the ID.

This is one of the most used ones and many developers already know about this. But it deserves to be in this list for those who don’t know. Paste the following code in your functions.php file:

  register_sidebar( array|string $args = array() )
function custom_sidebars() {
    $args = array(
        'id'            => 'custom_sidebar',
        'name'          => __( 'Custom Widget Area', 'text_domain' ),
        'description'   => __( 'A custom widget area', 'text_domain' ),
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
    );
    register_sidebar( $args );
}
  add_action( 'widgets_init', 'custom_sidebars' );

To display this sidebar or widget ready area in your theme add this code:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('custom_sidebar') ) : ?> dynamic_sidebar('custom_sidebar') <?php endif; ?>

38. Displays a welcome panel to introduce users to WordPress.

  function wp_welcome_panel() {
    echo "Hi Dashboard";
  }

39. add_user() || Creates a new user from the “Users” form using $_POST information

  add_user()

40. auth_redirect() || Checks if a user is logged in, if not it redirects them to the login page

  auth_redirect()

41. cache_users() || Retrieve info for user lists to prevent multiple queries by get_userdata()

  cache_users( array $user_ids )

42. edit_user() || Edit user settings based on contents of $_POST

  edit_user( int $user_id )

43. check_import_new_users() || Checks if the current user has permissions to import new users

 check_import_new_users( string $permission )

44. check_password_reset_key() || Retrieves a user row based on password reset key and login

 check_password_reset_key( string $key, string $login )

45. confirm_delete_users() || Retrieves a user row based on password reset key and login

 confirm_delete_users( array $users )

46. confirm_user_signup()|| New user signup confirmation

 confirm_user_signup( string $user_name, string $user_email )

47. create_user() || An alias of wp_create_user()

 create_user( string $username, string $password, string $email )
 function wp_create_user($username, $password, $email = '') {
    $user_login = wp_slash( $username );
    $user_email = wp_slash( $email    );
    $user_pass = $password;
 
    $userdata = compact('user_login', 'user_email', 'user_pass');
    return wp_insert_user($userdata);
}

48. delete_all_user_settings() || Delete the user settings of the current user

 delete_all_user_settings()

49. download_url() || Downloads a URL to a local temporary file using the WordPress HTTP Class

download_url( string $url, int $timeout = 300 )

50. add_user_meta() || Adds meta data to a user

  add_user_meta( int $user_id, string $meta_key, mixed $meta_value, bool $unique = false )

51. To count total user

  $usercount = count_users();
  $result = $usercount['total_users']; 

52. count_user_posts() || Number of posts user has written.

 count_user_posts( int $userid, array|string $post_type = 'post', bool $public_only = false )

53. get_current_user_id() || Get the current user’s ID

 get_current_user_id()

54. get option term


$image_set = get_option( 'image_default_link_type' );  
if ($image_set !== 'none') {
	update_option('image_default_link_type', 'none');
}

55. add_role() || add role, if it does not exist.

 add_role( string $role, string $display_name, array $capabilities = array() )

56. get autor meta info


  //get_the_author_meta( string $field = '', int $user_id = false )
get_the_author_meta( 'display_name', $post->post_author );
   // get_author_posts_url( int $author_id, string $author_nicename = '' )
get_author_posts_url( get_the_author_meta( 'ID' , $post->post_author));

57. absint() || Convert a value to non-negative integer

 absint( mixed $maybeint )
 echo absint( -10 );

58. activate_plugin() || Attempts activation of plugin in a “sandbox” and redirects on success

 activate_plugin( string $plugin, string $redirect = '', bool $network_wide = false, bool $silent = false )

59. activate_plugins() || Activate multiple plugins

 activate_plugins( string|array $plugins, string $redirect = '', bool $network_wide = false, bool $silent = false )

60. addslashes_gpc() || Adds slashes to escape strings.

 addslashes_gpc( string $gpc )

61. add_action() || Hooks a function on to a specific action

 add_action( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

62. add_blog_option() || Add a new option for a given blog id

 add_blog_option( int $id, string $option, mixed $value )

63. add_clean_index() || Adds an index to a specified table.

add_clean_index( string $table, string $index )

64. add_comments_page() || Add submenu page to the Comments main menu.

add_comments_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

65. add_comment_meta() || Add meta data field to a comment.

add_comment_meta( int $comment_id, string $meta_key, mixed $meta_value, bool $unique = false )

66. add_contextual_help() || Add contextual help text for a page

add_contextual_help( string $screen, string $help )

67. add_cssclass() || ...

add_cssclass( string $add, string $class )

68. add_custom_background() || Add callbacks for background image display

add_custom_background( callable $wp_head_callback = '', callable $admin_head_callback = '', callable $admin_preview_callback = '' )

69. add_custom_image_header() || Add callbacks for image header displa

add_custom_image_header( callable $wp_head_callback, callable $admin_head_callback, callable $admin_preview_callback = '' )

70. add_dashboard_page() || Add submenu page to the Dashboard main menu

add_dashboard_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function register_my_custom_menu_page(){
add_dashboard_page( 'custom menu title', 'Test', 'manage_options', 'custompage', 'my_custom_menu_page', plugins_url( 'test/images/icon.png' ), 6 ); 
}
function my_custom_menu_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Test</h2>';
	    echo 'Test';
	    echo '</div>';
}
add_action( 'admin_menu', 'register_my_custom_menu_page' );

71. add_menu_page() || Add new menu in admin dashboard

add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )

72. add_submenu_page() || Add submenu in menu

add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )
add_action('admin_menu', 'my_menu_pages');
function my_menu_pages(){
    add_menu_page('My Page Title', 'My Menu Title', 'manage_options', 'my-menu', 'my_menu_output_page','icon_url' ,'position');
    add_submenu_page('my-menu', 'Submenu Page Title', 'Whatever You Want', 'manage_options', 'my-menu1','my_menu_page' );
    add_submenu_page('my-menu', 'Submenu Page Title2', 'Whatever You Want2', 'manage_options', 'my-menu2','my_menu2_page');
}
function my_menu_output_page(){
        echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>my_menu_output_page</h2>';
	    echo 'Test';
	    echo '</div>';
}
function my_menu_page(){
        echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>my-menu1</h2>';
	    echo 'Test';
	    echo '</div>';
}
function my_menu2_page(){
        echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>my-menu2</h2>';
	    echo 'Test';
	    echo '</div>';
}

73. add_management_page() || Add submenu page to the Tools main menu

add_management_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function register_my_tools_page(){
add_management_page( 'tool page title', 'tools page', 'manage_options', 'customtool', 'my_custom_tool_page'); 
}
function my_custom_tool_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom Tool</h2>';
	    echo 'tool page';
	    echo '</div>';
}
add_action( 'admin_menu', 'register_my_tools_page' );

74. add_options_page() || Add submenu page to the Settings main menu

add_options_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function my_custom_setting_page(){
add_options_page( 'setting page title', 'setting page', 'manage_options', 'customsetting', 'my_custom_sett_page'); 
}
function my_custom_sett_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom Setting</h2>';
	    echo 'Setting Page';
	    echo '</div>';
}
add_action( 'admin_menu', 'my_custom_setting_page' );

75. add_pages_page() || Add submenu page to the Pages menu

add_pages_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function my_custom_paged_page(){
add_pages_page( 'page page title', 'page page', 'manage_options', 'custompage', 'my_custom_page_page'); 
}
function my_custom_page_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom page</h2>';
	    echo 'pagepage';
	    echo '</div>';
}
add_action( 'admin_menu', 'my_custom_paged_page' );

76. add_plugins_page() || Add submenu page to the Plugins main menu

add_plugins_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function my_custom_plugin_page(){
add_plugins_page( 'plug page title', 'plug page', 'manage_options', 'customplug', 'my_custom_plug_page'); 
}
function my_custom_plug_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom plug</h2>';
	    echo 'plug page';
	    echo '</div>';
}
add_action( 'admin_menu', 'my_custom_plugin_page' );

77. add_posts_page() || Add submenu page to the Posts main menu

add_posts_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function my_custom_post_page(){
add_posts_page( 'post page title', 'post page', 'manage_options', 'custompost', 'my_custom_po_page'); 
}
function my_custom_po_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom post</h2>';
	    echo 'post page';
	    echo '</div>';
}
add_action( 'admin_menu', 'my_custom_post_page' );

78. add_media_page() || Add submenu page to the Media main menu.

add_media_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function register_my_media_page(){
add_media_page( 'media page title', 'media page', 'manage_options', 'custommedia', 'my_custom_media_page'); 
}
function my_custom_media_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom media</h2>';
	    echo 'tool page';
	    echo '</div>';
}
add_action( 'admin_menu', 'register_my_media_page' );

79. add_theme_page() || Add submenu page to the Appearance main menu.

add_theme_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function register_my_theme_page(){
add_theme_page( 'theme page title', 'theme page', 'manage_options', 'customtheme', 'my_custom_them_page'); 
}
function my_custom_them_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom theme</h2>';
	    echo 'theme page';
	    echo '</div>';
}
add_action( 'admin_menu', 'register_my_theme_page' );

80. add_users_page() || Add submenu page to the Users/Profile main menu.

add_users_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

function register_my_user_page(){
add_users_page( 'user page title', 'user page', 'manage_options', 'customuser', 'my_custom_us_page'); 
}
function my_custom_us_page(){
	    echo '<div class="wrap"><div id="icon-tools" class="icon32"></div>';
	    echo '<h2>Custom user</h2>';
	    echo 'user page';
	    echo '</div>';
}
add_action( 'admin_menu', 'register_my_user_page' );

81. add_editor_style()|| Add callback for custom TinyMCE editor stylesheets.

  add_editor_style( array|string $stylesheet = 'editor-style.css' )

82. add_existing_user_to_blog()|| Add a user to a blog based on details from maybe_add_existing_user_to_blog()

  add_existing_user_to_blog( array $details = false )

83. add_feed() || Add a new feed type like /atom1/

  add_feed( string $feedname, callable $function )

84. add_filter() || Hook a function or method to a specific filter action

  add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

85. apply_filters() || Call the functions added to a filter hook

  apply_filters( string $tag, mixed $value )

86. add_filter() || Hook a function or method to a specific filter action

  add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

87. add_link() || Add a link to using values provided in $_POST

  add_link()

88. add_links_page() || Add submenu page to the Links main menu

  add_links_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

89. add_magic_quotes() || Walks the array while sanitizing the contents

  add_magic_quotes( array $array )

90. add_menu_classes() || ...

  add_menu_classes( array $menu )

91. add_network_option() || Add a new network option

  add_network_option( int $network_id, string $option, mixed $value )

92. add_new_user_to_blog() || Adds a newly created user to the appropriate blog

  add_new_user_to_blog( int $user_id, mixed $password, array $meta )

93. add_object_page() || Add a top-level menu page in the ‘objects’ section

 add_object_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '' )

94. add_object_page() || Add a top-level menu page in the ‘objects’ section

 add_object_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '' )

95. add_option_update_handler() || Register a setting and its sanitization callback

 add_option_update_handler( string $option_group, string $option_name, callable $sanitize_callback = '' )

96. add_option_whitelist() || Adds an array of options to the options whitelist

 add_option_whitelist( array $new_options, string|array $options = '' )

97. add_permastruct() || Add permalink structure.

 add_permastruct( string $name, string $struct, array $args = array() )

98. add_ping() || Add a URL to those already pinged

 add_ping( int|WP_Post $post_id, string|array $uri )

99. add_ping() || Add a URL to those already pinged

 add_ping( int|WP_Post $post_id, string|array $uri )

100. add_post_type_support() || Register support of certain features for a post type

 add_post_type_support( string $post_type, string|array $feature )

101. add_query_arg() || Retrieves a modified URL query string.

 add_query_arg()

102. add_rewrite_endpoint() || Add an endpoint, like /trackback/.

 add_rewrite_endpoint( string $name, int $places, string|bool $query_var = true )

103. add_rewrite_rule()|| Adds a rewrite rule that transforms a URL structure to a set of query vars

 add_rewrite_rule( string $regex, string|array $query, string $after = 'bottom' )

104. add_rewrite_tag()|| Add a new rewrite tag (like %postname%).

 add_rewrite_tag( string $tag, string $regex, string $query = '' )

105. add_rewrite_tag()|| Add a new rewrite tag (like %postname%).

 add_rewrite_tag( string $tag, string $regex, string $query = '' )

106. add_settings_field() || Add a new field to a section of a settings page

 add_settings_field( string $id, string $title, callable $callback, string $page, string $section = 'default', array $args = array() )

107. add_settings_section() || Add a new section to a settings page.

 add_settings_section( string $id, string $title, callable $callback, string $page )

108. add_shortcode() || Adds a new shortcode.

 add_shortcode( string $tag, callable $callback )

109. do_shortcode() || Search content for shortcodes and filter shortcodes through their hooks..

 do_shortcode( string $content, bool $ignore_html = false )

110. admin_url() || Retrieves the URL to the admin area for the current site

admin_url( string $path = '', string $scheme = 'admin' )

111. body_class() || Display the classes for the body element

   body_class( string|array $class = '' )

112. check_upload_mimes() || Check an array of MIME types against a whitelist.

   check_upload_mimes( array $mimes )

113. check_upload_mimes() || Check an array of MIME types against a whitelist.

   check_upload_mimes( array $mimes )

114. check_upload_size() || Determine if uploaded file exceeds space quota

  check_upload_size( array $file )

115. current_action() || Retrieve the name of the current action

 current_action()

116. current_filter() || Retrieve the name of the current filter or action

current_filter()

117. current_time() || Retrieve the current time based on specified type

current_time( string $type, int|bool $gmt )

118. do_robots() || Display the robots.txt file content.

do_robots()

119. esc_html() || Escaping for HTML blocks

esc_html( string $text )

120. esc_sql() || Escapes data for use in a MySQL query

esc_sql( string|array $data )

121. esc_textarea() || Escaping for textarea values

esc_textarea( string $text )

122. esc_url() || Checks and cleans a URL.

esc_url( string $url, array $protocols = null, string $_context = 'display' )

123. file_is_displayable_image() || Validate that file is suitable for displaying within a web page.

file_is_displayable_image( string $path )

124. file_is_valid_image() || Validate that file is an image

file_is_valid_image( string $path )

125. force_ssl_login() || Whether SSL login should be forced

force_ssl_login( string|bool $force = null )

126. format_to_post() || Formerly used to escape strings before inserting into the DB.

format_to_post( string $content )

127. format_to_post() || Formerly used to escape strings before inserting into the DB.

format_to_post( string $content )

128. generate_random_password() || Generates a random password.

  generate_random_password( int $len = 8 )

129. get_available_languages() || Get all available languages based on the presence of *.mo files in a given directory

 get_available_languages( string $dir = null )

130. get_available_post_mime_types() || Get all available post MIME types for a given post type.

 get_available_post_mime_types( string $type = 'attachment' )

131. get_available_post_mime_types() || Get all available post MIME types for a given post type.

 get_available_post_mime_types( string $type = 'attachment' )

132. get_avatar() || Retrieve the avatar `` tag for a user, email address, MD5 hash, comment, or post

 get_avatar( mixed $id_or_email, int $size = 96, string $default = '', string $alt = '', array $args = null )

133. get_avatar() || Retrieve the avatar `` tag for a user, email address, MD5 hash, comment, or post

 get_avatar( mixed $id_or_email, int $size = 96, string $default = '', string $alt = '', array $args = null )

134. get_categories() || Retrieve list of category objects.

 get_categories( string|array $args = '' )

135. get_category() || Retrieves category data given a category ID or category object

 get_category( int|object $category, string $output = OBJECT, string $filter = 'raw' )

136. get_cat_ID() || Retrieve the ID of a category from its name

 get_cat_ID( string $cat_name )

137. get_cat_name() || Retrieve the name of a category from its ID.

get_cat_name( int $cat_id )

138. get_date_from_gmt() || Converts a GMT date into the correct format for the blog

get_date_from_gmt( string $string, string $format = 'Y-m-d H:i:s' )

139. get_home_path() || Get the absolute filesystem path to the root of the WordPress installation

get_home_path()

140. get_home_url() || Retrieves the URL for a given site where the front end is accessible.

get_home_url( int $blog_id = null, string $path = '', string|null $scheme = null )

141. get_last_updated() || Get a list of most recently updated blogs

get_last_updated( mixed $deprecated = '', int $start, int $quantity = 40 )

142. add_theme_support() || Registers theme support for a given feature

add_theme_support( string $feature )

143. wp_enqueue_style() || Enqueue a CSS stylesheet

wp_enqueue_style( string $handle, string $src = '', array $deps = array(), string|bool|null $ver = false, string $media = 'all' )

144. wp_enqueue_script() || Enqueue a script

wp_enqueue_script( string $handle, string $src = '', array $deps = array(), string|bool|null $ver = false, bool $in_footer = false ))

145. get_template_directory_uri() || Retrieve theme directory URI.

get_template_directory_uri()

146. get_stylesheet_uri() || Retrieves the URI of current theme stylesheet.

get_stylesheet_uri() 

147. wp_style_add_data || Add metadata to a CSS stylesheet.

wp_style_add_data( string $handle, string $key, mixed $value )

148. wp_localize_script() || Localize a script

wp_localize_script( string $handle, string $object_name, array $l10n )
Latest Tutorial
Most Viewed Tutorial
bONEandALL