How to get ID of the page included with get_page()?
سؤال
I'm rewriting the question, including exemplary code, I hope it will be easier to understand now.
1. My shortcode:
function testid_shortcode( ) {
global $post;
return $post->ID;
}
add_shortcode('testid', 'testid_shortcode');
2. The issue:
I'm using the shortcode on page Example1 [ID=1]:
[testid]
Then I'm including it on different page Example 2 [ID=2]:
$included_page = get_page( $included_id );
$content = apply_filters('the_content', $included_page->post_content);
The shortcode returns "1" and "2" on these pages, while I want it to return "1" AND "1", so simply speaking I want it to retrieve the ID (specifically metaboxes) of the "original" page.
Is it possible to fix it somehow? I guess it should be done within the shortcode itself, but have absolutely no idea how. I guess passing a variable with the "original" ID and overwriting the one shortcode gets will do the trick, but how to do that?
لا يوجد حل صحيح
لا تنتمي إلى wordpress.stackexchange