{"id":22710,"date":"2019-01-08T21:10:47","date_gmt":"2019-01-08T13:10:47","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=22710"},"modified":"2022-10-18T20:12:18","modified_gmt":"2022-10-18T12:12:18","slug":"useful-wordpress-functions","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/","title":{"rendered":"15 Useful WordPress Functions All Developers Should Know"},"content":{"rendered":"<p>WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any user we wish and display their social media connections in a jiffy.<\/p>\n<p>There are however quite a few functions which seem to be overlooked for unknown reasons. I\u2019ve been coding with WordPress for around 8 years now and occasionally I still find something new! Let\u2019s take a look at some of my <strong>favourite overlooked functions<\/strong> and learn how to use them along the way.<\/p>\n<p class=\"note\"><strong>Recommended Reading: <\/strong><a href=\"https:\/\/www.hongkiat.com\/blog\/wordpress-conditional-tags-beginners\/\">WordPress Conditional Tags (And Snippets) For Beginners<\/a><\/p>\n<h2>antispambot()<\/h2>\n<p>I usually raise a few eyebrows with this one, it seems to be one of the most well-hidden functions in the codebase. <code>&lt;code&gt;antispambot()&lt;\/code&gt;<\/code> replaces characters with HTML entities which is one way to <strong>mask email addresses<\/strong> from evil scrapers.<\/p>\n<pre>\r\n$email = 'mymail@mail.com';\r\necho 'You can contact me at ' . antispambot( $email ) . ' any time'.\r\n<\/pre>\n<p>While this is a useful tidbit, it is also an example of why some people criticise WordPress \u2013 this is a horribly named function. From reading the function name, you have no idea what it does.<\/p>\n<h2>human_time_diff()<\/h2>\n<p>When I first learned about this function about a year ago I thought it must have been a recent addition which I overlooked in a changelog. Not quite\u2026<\/p>\n<p>This function \u2013 which outputs the difference between two timestamps \u2013 has been in since version 1.5 (that\u2019s February 17, 2018!).<\/p>\n<p>The following great snippet I borrowed from <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/human_time_diff\/\">the codex<\/a> shows how long ago a current post was published. It uses the <strong>publish date of the post as the first argument<\/strong> and the <strong>current date as the second<\/strong>.<\/p>\n<pre>\r\necho 'This post was published ' . human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) . ' ago';\r\n<\/pre>\n<h2>get_post_meta()<\/h2>\n<p>Bear with me here, I know this is a well-used function, however, how it works is not-so-common knowledge. First of all, by omitting the second and third parameters you can <strong>pull all metadata for a post<\/strong>.<\/p>\n<pre>\r\n$all_meta = get_post_meta( 14 );\r\n<\/pre>\n<p>Even if you only grab the data for a single key all postmeta is pulled anyway.<\/p>\n<p>The reason is actually pretty logical. Metadata is used in multiple places. If <code>&lt;code&gt;get_post_meta()&lt;\/code&gt;<\/code> queries the database each time it was used we would end up with way too many queries. Instead, if you pull metadata it caches it all and uses the cached values on all subsequent metadata retrievals.<\/p>\n<h2>wp_upload_bits()<\/h2>\n<p>This function is a straight-up <strong>file uploading function<\/strong>. While it doesn\u2019t move the file to the uploads folder and add it to the WordPress media section, it is extremely convenient and you can always do the rest with the <code>&lt;code&gt;wp_insert_attachment()&lt;\/code&gt;<\/code> function.<\/p>\n<pre>\r\n$upload = wp_upload_bits( $file['name'], null, file_get_contents( $file['tmp_name'] ) );\r\n<\/pre>\n<p>Some explanation is at hand for this: the first parameter is the file name. The second is depreciated so it should be set to null (eyeroll at WordPress consistency). The third parameter is the actual content of the file.<\/p>\n<h2>get_post_field()<\/h2>\n<p>In the past I saw quite a few examples where someone wrote a loop to get a comment count for a post, or wrote a dedicated database query for it. You don\u2019t need them, what you need is <code>&lt;code&gt;get_post_field()&lt;\/code&gt;<\/code>. This function <strong>retrieves the value of a single field for a single post<\/strong> in the database. Let\u2019s grab a comment count!<\/p>\n<pre>\r\nThis post has &lt;?php echo get_post_field( 'comment_count', 4124 ) ?&gt; comments.\r\n<\/pre>\n<h2>wpautop()<\/h2>\n<p>This function has come out into the spotlight a bit, but it is still relatively unknown. It is similar to the PHP native <code>nl2br<\/code> but instead of creating new lines, it <strong>wraps your content in paragraphs<\/strong>.<\/p>\n<p>This is useful if you have a textbox and you want to make sure that when users create paragraphs with double line breaks, they remain visible in the front-end as well.<\/p>\n<pre>\r\n&lt;h2&gt;What Our Users Say&lt;\/h2&gt;\r\n&lt;?php echo wpautop( $user_comment ) ?&gt;\r\n<\/pre>\n<h2>wp_is_mobile()<\/h2>\n<p>This aptly named function <strong>detects when a user is on a mobile device and allows you to display content accordingly<\/strong>. Since this is a conditional tag it returns true or false depending on the scenario.<\/p>\n<pre>\r\n&lt;?php if( wp_is_mobile() ) : ?&gt;\r\nVisit our website on your desktop for a richer user experience\r\n&lt;?php endif ?&gt;\r\n<\/pre>\n<h2>wp_redirect()<\/h2>\n<p>The last example shows another neat function: <code>&lt;code&gt;wp_redirect()&lt;\/code&gt;<\/code>. This should be used in place of the PHP native &lt;code&gt;header()&lt;\/code&gt; function. The WordPress redirection function allows you to <strong>set a URL to redirect to, and also set a status code<\/strong>, great for handling permanent redirects as well.<\/p>\n<pre>\r\n\/\/ For a URL which is no longer in use\r\nwp_redirect( 'http:\/\/website.com\/new-url\/', 301 );\r\n<\/pre>\n<h2>paginate_links()<\/h2>\n<p>I bet that this function owes its obscurity in part to the popularity of the <a href=\"https:\/\/wordpress.org\/plugins\/wp-pagenavi\/\">WP-PageNavi<\/a> plugin. By default WordPress <strong>displays previous\/next links at the end of your post list<\/strong>. WP-PageNavi <strong>replaces that with page numbers<\/strong>.<\/p>\n<p>This can actually be done with a little work using the <code>&lt;code&gt;paginate_links()&lt;\/code&gt;<\/code> functions. It has quite a few parameters so I recommend taking a peek at <a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/paginate_links\">the documentation<\/a>.<\/p>\n<p>The following example from the codex shows how you can add it to a default loop but adding it to custom loops is not much of a stretch.<\/p>\n<pre>\r\nglobal $wp_query;\r\n$big = 999999999; \/\/ need an unlikely integer\r\necho paginate_links( array(\r\n    'base' =&gt; str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),\r\n    'format' =&gt; '?paged=%#%',\r\n    'current' =&gt; max( 1, get_query_var('paged') ),\r\n    'total' =&gt; $wp_query-&gt;max_num_pages\r\n) );<\/pre>\n<h2>wp_die()<\/h2>\n<p>This function complements the PHP <code>die()<\/code> function. The difference is that this function will display a WordPress-styled HTML instead of just a plain text. You can use this function to stop PHP execution. You can add the message, title, and additional arguments to be displayed, for example:<\/p>\n<pre>\r\nwp_die( \"Oops, you don't have access to the\", \"Permission Denied\" );\r\n<\/pre>\n<h2>has_block()<\/h2>\n<p>In version 5.0, WordPress introduced a block based editor, codenamed Gutenberg. This function will identify whether the the content contains a Gutenberg, quite the same with the <code>has_shortcode()<\/code> function. It\u2019ll return <code>true<\/code> if the content does contain a block, or <code>false<\/code> if it does not.<\/p>\n<pre>&lt;?php\r\nif ( has_block() ) {\r\n    \/\/ Content has a block.\r\n} ?&gt;<\/pre>\n<h2>wp_set_script_translations()<\/h2>\n<p>Since many part of WordPress user interface is going to move to JavaScript, it needs a convenient way to register translatable texts in the JavaScript that WordPress could parse and understand. Use this function to set translated strings for your scripts. Below is an example:<\/p>\n<pre>wp_enqueue_script( 'my-script', plugins_url( 'js\/my-script.js', __FILE__ ) );\r\nwp_set_script_translations( 'my-script', 'mu-text-domain' );<\/pre>\n<h2>register_block_type()<\/h2>\n<p>Another prominent function in WordPress 5.0. This function allows you to register a new block in the new WordPress editor. Your block will appear in the new editor and insert it .<\/p>\n<pre>register_block_type( 'my-plugin\/new-block', array(\r\n    'title' =&gt; 'New Block',\r\n    'icon' =&gt; 'megaphone',\r\n    'category' =&gt; 'widgets',\r\n    'render_callback' =&gt; 'render_function_callback',\r\n) );<\/pre>\n<h2>rest_do_request()<\/h2>\n<p>This function allows you to make a call to WordPress REST API endpoints through PHP. Pretty useful when you need to retrieve an output from the REST API to process that you\u2019ll process further within the PHP side instead of in the browser (front-end) side.<\/p>\n<pre>$request = new WP_REST_Request( 'GET', \"\/wp\/v2\/posts\" );\r\n$request-&gt;set_header( 'X-WP-Nonce', wp_create_nonce( 'wp_rest' ) );\r\n$response = rest_do_request( $request );\r\n$data = 200 === $response-&gt;get_status() ? $response-&gt;get_data() : [];<\/pre>\n<h2>rest_preload_api_request()<\/h2>\n<p>When building a JavaScript-heavy UI in WordPress typically needs a set of initial data proloaded within the page. This is the function that will allow you to do so. This function is meant to be used in conjunction with the <code>array_reduce<\/code>, for example.<\/p>\n<pre>\r\n\/\/ Preload common data.\r\n$preload_paths = array(\r\n    '\/',\r\n    '\/wp\/v2\/types?context=edit',\r\n    '\/wp\/v2\/taxonomies?per_page=-1&context=edit',\r\n    '\/wp\/v2\/themes?status=active',\r\n);\r\npreload_data = array_reduce(\r\n\t$preload_paths,\r\n\t'rest_preload_api_request',\r\n\tarray()\r\n);\r\nwp_add_inline_script(\r\n\t'wp-api-fetch',\r\n\tsprintf( 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );', wp_json_encode( $preload_data ) ),\r\n\t'after'\r\n);\r\n<\/pre>\n<h2>Conclusion<\/h2>\n<p>These are just some functions that seem to be less-known that the rest. I discover a new great function about every two months and I\u2019m sure my developer friends out there could surprise us even further.<\/p>\n<p>If you have a favorite obscure function or a function which would be useful but isn\u2019t available, let us know in the comments!<\/p>","protected":false},"excerpt":{"rendered":"<p>WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any user we wish and display their social media connections in a jiffy. There are however quite a few functions which seem to be overlooked for unknown reasons. I\u2019ve&hellip;<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[49],"tags":[4663,3384],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>15 Useful WordPress Functions All Developers Should Know - Hongkiat<\/title>\n<meta name=\"description\" content=\"WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"15 Useful WordPress Functions All Developers Should Know\" \/>\n<meta property=\"og:description\" content=\"WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-08T13:10:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-18T12:12:18+00:00\" \/>\n<meta name=\"author\" content=\"Thoriq Firdaus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tfirdaus\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoriq Firdaus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/\"},\"author\":{\"name\":\"Thoriq Firdaus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\"},\"headline\":\"15 Useful WordPress Functions All Developers Should Know\",\"datePublished\":\"2019-01-08T13:10:47+00:00\",\"dateModified\":\"2022-10-18T12:12:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/\"},\"wordCount\":1111,\"commentCount\":16,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"keywords\":[\"ad-divi\",\"wordpress functions\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/\",\"name\":\"15 Useful WordPress Functions All Developers Should Know - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"datePublished\":\"2019-01-08T13:10:47+00:00\",\"dateModified\":\"2022-10-18T12:12:18+00:00\",\"description\":\"WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/useful-wordpress-functions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"15 Useful WordPress Functions All Developers Should Know\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\",\"name\":\"Thoriq Firdaus\",\"description\":\"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.\",\"sameAs\":[\"https:\\\/\\\/thoriq.com\",\"https:\\\/\\\/x.com\\\/tfirdaus\"],\"jobTitle\":\"Web Developer\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/thoriq\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"15 Useful WordPress Functions All Developers Should Know - Hongkiat","description":"WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/","og_locale":"en_US","og_type":"article","og_title":"15 Useful WordPress Functions All Developers Should Know","og_description":"WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any","og_url":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2019-01-08T13:10:47+00:00","article_modified_time":"2022-10-18T12:12:18+00:00","author":"Thoriq Firdaus","twitter_card":"summary_large_image","twitter_creator":"@tfirdaus","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Thoriq Firdaus","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/"},"author":{"name":"Thoriq Firdaus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807"},"headline":"15 Useful WordPress Functions All Developers Should Know","datePublished":"2019-01-08T13:10:47+00:00","dateModified":"2022-10-18T12:12:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/"},"wordCount":1111,"commentCount":16,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"keywords":["ad-divi","wordpress functions"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/","url":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/","name":"15 Useful WordPress Functions All Developers Should Know - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"datePublished":"2019-01-08T13:10:47+00:00","dateModified":"2022-10-18T12:12:18+00:00","description":"WordPress is full of great functions for us developers to use. We can pull post lists out of thin air, manipulate almost everything about them, grab any","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/useful-wordpress-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"15 Useful WordPress Functions All Developers Should Know"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807","name":"Thoriq Firdaus","description":"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.","sameAs":["https:\/\/thoriq.com","https:\/\/x.com\/tfirdaus"],"jobTitle":"Web Developer","url":"https:\/\/www.hongkiat.com\/blog\/author\/thoriq\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-5Ui","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/22710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=22710"}],"version-history":[{"count":4,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/22710\/revisions"}],"predecessor-version":[{"id":46725,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/22710\/revisions\/46725"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=22710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=22710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=22710"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=22710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}