I want to redirect users to a page on which a particular short-code has been used after they login. So basically I want to know how can I get the permalink of that particular page on which my plugins specific short code has been used?

  • 1
    Add some code to clarify your question. I read it twice but still dont understand ur situcation – Pmpr Dec 21 '15 at 10:15

I think that the very best approach would be to store that page on a option.

Anyway, if you want to get the pages where a shortcode has been used, you can use the search parameter (s) of WP_Query class (or get_posts() function). Basically, this parameter performs a LIKE query, so it could be useful to search for shortcodes like this:

$args = array(
    's'         => '[myshortcode',
    'post_type' => 'pages'

$pages_with_myshortcode = get_posts( $args );
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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