Wordpress: how to set hook priority?
I have this function and hook to redirect a visitor right after the registration.
It doesn't work. As far as I see the code is right, then I guess that might be other plugin using the same plugin.
Is there a way to set the priority of my hook to override the other one?
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect' );
wordpress
add a comment |
I have this function and hook to redirect a visitor right after the registration.
It doesn't work. As far as I see the code is right, then I guess that might be other plugin using the same plugin.
Is there a way to set the priority of my hook to override the other one?
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect' );
wordpress
add a comment |
I have this function and hook to redirect a visitor right after the registration.
It doesn't work. As far as I see the code is right, then I guess that might be other plugin using the same plugin.
Is there a way to set the priority of my hook to override the other one?
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect' );
wordpress
I have this function and hook to redirect a visitor right after the registration.
It doesn't work. As far as I see the code is right, then I guess that might be other plugin using the same plugin.
Is there a way to set the priority of my hook to override the other one?
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect' );
wordpress
wordpress
asked Nov 15 '18 at 9:35
JPashsJPashs
4,03382028
4,03382028
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
add_filter Format like this,
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
For E.g.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
In your code, you can set the priority as like,
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
Get more details: https://developer.wordpress.org/reference/functions/add_filter/
add a comment |
Try This:
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect',3);
add_filter accepts the 3rd argument as priority. Default value is 10 so enter any value lower then 10 to set the priority.
add a comment |
Try
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5 );
The last digit 5 is the priority. Default is 10. You can lower it further and check which number works for you.
add a comment |
Try passing argument in the function alongwith setting priority :
function somlaw_registration_redirect( $redirect_url )
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 3 );
Note: Also try changing the priority.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316341%2fwordpress-how-to-set-hook-priority%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
add_filter Format like this,
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
For E.g.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
In your code, you can set the priority as like,
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
Get more details: https://developer.wordpress.org/reference/functions/add_filter/
add a comment |
add_filter Format like this,
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
For E.g.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
In your code, you can set the priority as like,
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
Get more details: https://developer.wordpress.org/reference/functions/add_filter/
add a comment |
add_filter Format like this,
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
For E.g.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
In your code, you can set the priority as like,
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
Get more details: https://developer.wordpress.org/reference/functions/add_filter/
add_filter Format like this,
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
For E.g.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
In your code, you can set the priority as like,
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
Get more details: https://developer.wordpress.org/reference/functions/add_filter/
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 )
...
return $maybe_modified_value;
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5, 2 );
answered Nov 15 '18 at 9:46
Priyanka ModiPriyanka Modi
1,0541611
1,0541611
add a comment |
add a comment |
Try This:
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect',3);
add_filter accepts the 3rd argument as priority. Default value is 10 so enter any value lower then 10 to set the priority.
add a comment |
Try This:
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect',3);
add_filter accepts the 3rd argument as priority. Default value is 10 so enter any value lower then 10 to set the priority.
add a comment |
Try This:
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect',3);
add_filter accepts the 3rd argument as priority. Default value is 10 so enter any value lower then 10 to set the priority.
Try This:
function somlaw_registration_redirect()
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect',3);
add_filter accepts the 3rd argument as priority. Default value is 10 so enter any value lower then 10 to set the priority.
answered Nov 15 '18 at 9:39
Darsh khakhkharDarsh khakhkhar
42929
42929
add a comment |
add a comment |
Try
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5 );
The last digit 5 is the priority. Default is 10. You can lower it further and check which number works for you.
add a comment |
Try
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5 );
The last digit 5 is the priority. Default is 10. You can lower it further and check which number works for you.
add a comment |
Try
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5 );
The last digit 5 is the priority. Default is 10. You can lower it further and check which number works for you.
Try
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 5 );
The last digit 5 is the priority. Default is 10. You can lower it further and check which number works for you.
answered Nov 15 '18 at 9:39
zipkundanzipkundan
1,2661514
1,2661514
add a comment |
add a comment |
Try passing argument in the function alongwith setting priority :
function somlaw_registration_redirect( $redirect_url )
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 3 );
Note: Also try changing the priority.
add a comment |
Try passing argument in the function alongwith setting priority :
function somlaw_registration_redirect( $redirect_url )
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 3 );
Note: Also try changing the priority.
add a comment |
Try passing argument in the function alongwith setting priority :
function somlaw_registration_redirect( $redirect_url )
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 3 );
Note: Also try changing the priority.
Try passing argument in the function alongwith setting priority :
function somlaw_registration_redirect( $redirect_url )
return home_url( '/my-page' );
add_filter( 'registration_redirect', 'somlaw_registration_redirect', 3 );
Note: Also try changing the priority.
answered Nov 15 '18 at 10:28
wpgeek1311wpgeek1311
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316341%2fwordpress-how-to-set-hook-priority%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown