So the answer was to use base64_encode and base64_decode.
So basically doing something like this to set the transient:
$json_contact_info = json_encode( $contact_info );
$transient_data = encrypt_text( $json_contact_info );
$transient_array = base64_encode( $transient_data );
$transient_set = set_transient( $transient_name, $transient_array, 60 * 60 * 24 * 7 );
And then to get the transient:
$decrypted_transient_data = decrypt_text( base64_decode( $transient_data ) );
$cr_json = json_decode( $decrypted_transient_data );
Related Posts:
- When should I be using the Transients API?
- Cache remote (HTTP) request with Transients API
- Is there any danger in deleting all transients?
- Why are transients cleared prematurely?
- Get a list of existing transients
- Storing posts social counters by using transient api
- How to save new transients if query changes?
- Integrating WP-TLC-Transients with WordPress – Where to Begin?
- Is priming a Transient Cache possible?
- What causes a transient to changes status to “Does Not Expire”?
- Reset Transient on New Day
- How to use transients and variables
- Transient storage location? database/xcache/w3Total Cache?
- How to delete transients written by fetch_feed()?
- Set Transient expiration
- WordPress transient doesn’t use the transient
- How do I reset a transient when updating a widget’s value?
- How to clear Transients on all sites in Multi Sites environment
- Is this the proper usage of creating / using a transient?
- Should I use the Transients API to temporarily hold edited attachements?
- transient or not transient
- Can Transients be used to store sensitive data?
- wp_options flooded with transient API entires
- Why Transients may not work correctly?
- How many transients is too many transients
- Synchronize Data every minute with set_transient
- Difference between get_site_transient() and get_transient()
- delete_transient on click inside a widget form
- Set_Transient to end at midnight
- Whats wrong with this transient? Not caching as expected
- Set transient with get posts error
- Clear Transients
- Unique Transients user id for Non-Logged In users
- Transient is never set. Why?
- Button to clear transients
- Set transient name
- Hacked site using transient API?
- Ajax call to transients
- Doesn’t set_transient() add multiple rows with the same key?
- What would cause set_transient() and set_site_transient() to fail silently?
- Is it possible to decrypt MD5 hashes?
- AES Decryption in Python when IV and Value provided separately
- Chrome not Firefox are not dumping to SSLKEYLOGFILE variable
- Chrome not Firefox are not dumping to SSLKEYLOGFILE variable
- File extension .DB – What kind of database is it exactly?
- Given final block not properly padded
- How to encrypt String in Java
- mcrypt is deprecated, what is the alternative?
- Simplest two-way encryption using PHP
- How can I list the available Cipher algorithms?
- Encrypt & Decrypt using PyCrypto AES 256
- Encrypt with private key and decrypt with public key
- How to use OpenSSL to encrypt/decrypt files?
- Encrypt Password in Configuration Files?
- Encrypt Password in Configuration Files?
- gpg decryption fails with no secret key error
- RSA encryption and decryption in Python
- RSA Public Key format
- Is there any difference between aes-128-cbc and aes-128 encryption?
- JavaScript string encryption and decryption?
- What is the easiest way to encrypt a password when I save it to the registry?
- Encrypt and decrypt a string in C#?
- Are transients garbage collected?
- How does object caching work?
- How to store username and password to API in wordpress option DB?
- Should I use Transient API to store HTML String, or Object?
- Will it break my site if I delete all transient records in wp_options table?
- Is get_option() faster than accessing get_transient()?
- Best practices for using the transients API
- Are transients private or public?
- How WordPress encrypt password? [duplicate]
- Are the default salts secure?
- Using transients in conjunction with memcached
- wp-cron.php – How are WP’s Cron transients removed?
- Do WordPress’ cron’s clean up expired transients?
- Using a wildcard with delete_transient()
- Does set_transient() overwrite/update transient option with same key?
- What’s the case against transient-ing almost everything that’s mostly static?
- How to validate WordPress generated password in DB using PHP?
- Does using set_transient() function can lead to MySQL problems?
- Fallback when Transient API fails
- Why does WordPress create two transients with the same name when I specify timeout value?
- How to delete cached transients from a widget instance properly?
- Security in WordPress plugin development
- Fragment caching increasing database queries
- Should I store external API data in my WP database or keep it as a transient?
- WordPress transients for a shortcode
- Encrypt emails?
- How to purge all transient caches?
- How to delete a transient on post/page publish?
- Should the caching of WordPress menus be specific to each page?
- Long option names fail silently?
- Use Transient API to cache queries for all posts in all categories?
- Looping through posts per category gives same posts for each category
- How to make sure that only one wp_cron() runs at a time?
- Transients vs CRON +Custom Fields: Caching Data Per Post
- Transient not working for custom loops
- WP_Cron doesn’t do the job: Multisite stats
- Transient pagination not working properly
- pre_set_site_transient_update_plugins wont call on hosted webspace