[wp-hackers] Get URL of page with shortcode

Ryan Bilesky rbilesky at gmail.com
Wed Feb 2 06:59:14 UTC 2011


That would just link me to the current page, I need to get the link to the
page with a specific shortcode.  I was just wondering if there is a more
correct method than using wpdb to query for the id where content =
myshortcode.

On Feb 1, 2011 10:00 PM, "Eddie O&apos;Leary" <eddie at teamcolab.com> wrote:
> It seems that you could put the following code inside the shortcode
> function:
>
> global $post;
> $url = get_permalink($post->ID);
>
> $url will equal the permalink of the post that is parsing the shortcode.
>
> Thanks,
>
> Eddie
>
> On Tue, Feb 1, 2011 at 10:41 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:
>
>> I am looking for a way in my plugin the get the URL for the page which
>> contains a specific shortcode for my plugin, is there an easy way to do
>> this, or do I need to do a query with wpdb against the page content?
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> Eddie O'Leary
> President
> CO+LAB Multimedia
>
> 201 W 7th St.
> Richmond, VA 23224
> www.teamcolab.com
>
> 804-433-3582 office
> 804-475-4502 cellular
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list