Empty trash hook in wordpress

In some cases we may want to delete data related to certain post stored in some custom table (i.e. data which is currently not in wordpress).

If the data related to a post is not in wordpress then it won’t get cleaned once the post is deleted from the wordpress and you may end up garbage and unmanageable data in your custom table.

e.g. we have a custom post to register attendees to our events. There is also a need to log if the user had attended previous events too and to maintain their preferences for each year/event. Since it is not possible to store such yearwise/eventwise data in wordpress through custom fields, we may end up creating our own custom table.

The requirement is when the user gets deleted from the system, the data stored about the user in the custom table should also get deleted

WordPress provides a hook to clean such data stored in your custom table.

 

 

How to install Cocoapods

How to install Cocoapods

Start by typing below command in terminal

In most cases just the second command would however sometimes you may get below error in case you have an older version of activesupport installed

Error installing cocoapods: activesupport requires Ruby version >= 2.2.2

The first command will make sure you don’t get the above error

Once the above commands run successfully type below command to set up Cocoapods master repo

This will download the master repo. The size of the repo is quite big around 380MB so it can take a while depending upon your internet download speed.

Once the above is completed, navigate within terminal to your Xcode project and run below command to create the podfile

Open the newly created podfile with text editor, and add the required libraries e.g.

pod ‘Google/Analytics’

Then run below command to install the required libraries