Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#7275 closed defect (bug) (worksforme)

get_permalink argument must be passed in quotes

Reported by: sillybean's profile sillybean Owned by:
Milestone: Priority: low
Severity: minor Version:
Component: Template Keywords:
Focuses: Cc:


It seems that the following should work:

<?php echo get_permalink($post->post_parent); ?>

It doesn't, however, unless you enclose the argument in quotes:

<?php echo get_permalink("$post->post_parent"); ?>

Change History (1)

#1 @DD32
15 years ago

  • Component changed from General to Template
  • Resolution set to worksforme
  • Status changed from new to closed

I see no logical reason why either of your codes should not work.
It works fine for me:

$subpageid = 315;
$subpage = get_post($subpageid);

echo get_permalink($subpage->post_parent) , '<br />';
echo get_permalink($subpage->ID);

Note: See TracTickets for help on using tickets.