I am trying to minimize my workload in the future by putting recycled content into tokens, so that I only have to update the token as opposed to updating each individual node that uses the same content. I have little experience with tokens, so my question is very basic.

Example of what I want.. say I have the following on dozens of different nodes:

Item 1: $29.99

Rather than having to update each node when 'Item 1' gets a price change, I'd rather have each node just using a token for 'Item 1', so that I only have to update the token instead of all the nodes. I've installed the Custom Tokens module, but don't understand how to display my custom token in the node's content body. If I set the custom token name as "token-1", how would I display the token in the actual content? ie. [token-1], [custom:token-1] etc don't work.

Any help would be greatly appreciated!

2 Answers 2


You'll want to have the Token filter module installed and configured in your text formats to use tokens in the node body.

  • I ran into this exact scenario, and detailed the whole solution using Custom Token here
    – Timmah
    Jul 20, 2015 at 3:56

Try token_replace in hook_nodeapi for D6 or hook_node_load for D7



$text: A string potentially containing replaceable tokens.

$data: (optional) An array of keyed objects. For simple replacement scenarios 'node', 'user', and others are common keys, with an accompanying node or user object being the value. Some token types, like 'site', do not require any explicit information from $data and can be replaced even if it is empty.

$options: (optional) A keyed array of settings and flags to control the token replacement process. Supported options are:

language: A language object to be used when generating locale-sensitive tokens. callback: A callback function that will be used to post-process the array of token replacements after they are generated. For example, a module using tokens in a text-only email might provide a callback to strip HTML entities from token values before they are inserted into the final text. clear: A boolean flag indicating that tokens should be removed from the final text if no replacement value can be generated. sanitize: A boolean flag indicating that tokens should be sanitized for display to a web browser. Defaults to TRUE. Developers who set this option to FALSE assume responsibility for running filter_xss(), check_plain() or other appropriate scrubbing functions before displaying data to users.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.