Save the priority in your options and pass that value to your add_filter:
add_action( 'template_redirect', 'wpse_81687_prepare_filter' );
function wpse_81687_prepare_filter()
{
$my_options = get_option( 'my_options' );
$priority = isset ( $my_options['content_filter_priority'] )
? $my_options['content_filter_priority']
: 10;
add_filter( 'the_content', 'ald_crp', $priority );
}
In my example I register the the_content filter during template_redirect because it is not needed earlier. You don’t need the filter in wp-admin or a login page.
You could even use the_post as hook instead of template_redirect. But then … another piece of code might call echo apply_filters('the_content', $some_text ); without calling setup_postdata() before.
Related Posts:
- Where is the best place to use add_filter
- How to only hook on Single.php after content?
- What characters are allowed as a shortcode tag and how should they be sanitized?
- How to remove filter added by another plugin in a class
- Using add_filter inside another class
- How can I show drafts in wp_dropdown_pages list?
- Hide WordPress Plugin Deactivation Links
- Alter post slug by a filter that is fired just after a post is created
- Failed to invoke other hook from the init hook
- Does the ‘nav_menu_css_class’ filter accept 2 or 3 arguments?
- Very stubborn wp_register_script / add_action vs remove
- do_action and hook methods
- Remove action from a plugin class, forced to use global instance
- ElasticPress how to Include Meta to the mapping?
- remove filter which calls a public static function
- There’s some way to add a wrapper around posted images?
- Custom preview_post_link not working for draft post
- Determine plugin name from within plugin_action_links filter
- Reposition Woocommerce Message
- How to remove xmlns on language_attributes()?
- How to modify shortcode attributes with data from current post
- add_filter comment_edit_redirect not working
- Can I hook into get_avatar to supply a hash instead of an email?
- When to call add_filter
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- Edit default comments page in WP Admin
- Inserting above the comment template
- Creating a plugin to sanitize comment and the url field before display only
- Modifying the comments section through a plugin regardless of theme
- How to check current user before all actions and filters?
- How do I create a filter feature on WordPress? [closed]
- Passing an array from shortcode-function to filter-function
- Get Time Taken By Each Action Hook in WordPress
- qTranslate remove default directory from link
- How to disable a plugin for certain page?
- WordPress user account activation
- URL parameters causing 404 on home page, but nowhere else
- Which filter affects the ‘entry-title’ post class
- How to change the name of the “edit my profile” link in the WordPress admin backend
- Redirect to another page using contact form 7? [closed]
- Template filter for custom taxonomy terms
- What exactly happens to function argument availability when using a filter?
- Check filter defined or not?
- How can I apply a WP filter on specific plugin version
- Editing wp-config.php
- How to use the pre_option filter before a plugin loads?
- WordPress: Add custom add_filter for custom functions
- Override a Plugin Function
- Can I filter a function created by a theme or a plugin?
- How to have free shipping for WooCommerce Membership members
- Add a function call after content automatically?
- Hook for altering the content of all wp mails
- Looking for a filter to modify the months
- What’s the best way to echo out a filter variable?
- Edit post image attributes on fly?
- apply_filters(woocommerce_get_item_data, …) Causing errors when adding to cart
- How to convert Currency from USD to other IP Based currency in Php function
- post title not changing at post page
- Using OR Condition with facetwp facets
- How i remove specific script from header?
- Randomize post (and page) IDs on generation
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- Making a list that can be filtered by category/tags
- How to use third-party SendGrid Email Validation API in Gravity Forms?
- taxonomy_template filter not working on pagination [duplicate]
- 500 Internal server error wp_handle_upload_prefilter
- How to Unhook actions/filters in within Class in plugin
- Nested Actions and Filters
- Using Filters to modify contect – DB query results alwats appear fist
- Customize plugin templates
- ACF Taxonomy search on backend (Relationship field)
- What action or filter can I use to change all the html returned from server for a page?
- Can I add content before post content without using the_content filter
- WordPress Add advertising ads befor and after content with periority [closed]
- Edit plugin filter
- trying to create simple plugin to filter categories from all authors
- How do i get all author posts on custom post type list
- How to filter a a variable in a plugin’s function?
- Retrive images from the_content()
- Filter the HTML content of plugin
- apply_filters to content but ignore shortcodes
- change output location of plugin function using a custom hook
- getpost content with all formatting for admin pages
- Which filters or actions involve with index page for plugin?
- Add a filter to a different custom plugin
- How to add a filter conditionally based on page related Conditional Tags
- WP Members additional fields on user profile [closed]
- How to Add Extra Text In WordPress Title Before Post Publish
- How often should I execute add_filter and function declaration in Code Snippets?
- WordPress REST API filter on blank custom ACF
- Selectively override Easy Digital Downloads protection via filter
- Brands Filter Not Working For On Sale Products
- FacetWP custom display based on post type [closed]
- Removing filters with arguments set in a class
- is_singular() in mu-plugins not working
- Remove wpseo filter from polylang plugin
- How can we extent core/group or cover block?
- Customize WP Filter Hook
- How to display title, description etc in block images?
- How to customize WP_Error (REST JWT authentication plugin) [closed]