• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
WordPress transients 101
 

WordPress transients 101

on

  • 322 views

 

Statistics

Views

Total Views
322
Views on SlideShare
322
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    WordPress transients 101 WordPress transients 101 Presentation Transcript

    • WORDPRESSTRANSIENTS101A BASIC GUIDE TO WORDPRESSTRANSIENTSBY @CHRISAPREA
    • WHAT ARE TRANSIENTS?Transients allow you to store non timesensitive data for a specified timeperiod.After this time period has expired youwill fetch an updated version of thedata being stored.
    • PRACTICAL TRANSIENTUSAGE• Twitter / Facebook / social media feed• A popular articles widget• Recent articles widget• Non time sensitive database queries• Expensive non time sensitive PHP routines• Other non time sensitive API calls (flickr, YouTube, etc)• Instead of cron?
    • 3 FUNCTIONS TO RULE THEMALL1. get_transient()2. set_transient()3. delete_transient()
    • WHAT CAN WE STORE INTRANSIENTS?• Strings / HTML• Arrays / Objects (auto serialized)
    • TIME TO CODE  / If( false === ( $api_data = get_transient( ‘my_api_call’ ) ) ){ // generate the transient data $api_data = some_api_call(); // save the transient data set_transient( ‘api_data’, $api_data, 60 * 60 * 24 );}// do stuff with transient data ( $api_data )
    • EXAMPLE TIMEAPREA.ME/DEMOS/TRANSIENTS
    • THANKS! @CHRISAPREAAPREA.ME/DEMOS/TRANSIENTS